update README
This commit is contained in:
		
							parent
							
								
									0c2692f9fb
								
							
						
					
					
						commit
						81333f4c47
					
				
							
								
								
									
										18
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								README.md
									
									
									
									
									
								
							@ -3,13 +3,17 @@
 | 
			
		||||
Like calling `map()` and resolving with `Promise.all()`,
 | 
			
		||||
but handling a bounded number of items at any given time.
 | 
			
		||||
 | 
			
		||||
## Install
 | 
			
		||||
Want to read about it?
 | 
			
		||||
 | 
			
		||||
- [Batching async requests in < 50 lines of VanillaJS](https://coolaj86.com/articles/batching-async-requests-50-lines-of-vanilla-js/)
 | 
			
		||||
 | 
			
		||||
# Install
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
npm install --save batchasync
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## Usage
 | 
			
		||||
# Usage
 | 
			
		||||
 | 
			
		||||
```js
 | 
			
		||||
// Browsers
 | 
			
		||||
@ -35,10 +39,14 @@ batchAsync(batchSize, things, doStuff).then(function(results) {
 | 
			
		||||
});
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
### Returning 'undefined'
 | 
			
		||||
## A note on 'undefined'
 | 
			
		||||
 | 
			
		||||
Returning `undefined` will cause an exception to be thrown
 | 
			
		||||
(because it looks like a skipped promise). Return `null` instead.
 | 
			
		||||
Returning `undefined` will cause an exception to be thrown,
 | 
			
		||||
and the Promise to be rejected.
 | 
			
		||||
 | 
			
		||||
This is on purpose - because `undefined` is indistinguishable from a skipped Promise.
 | 
			
		||||
 | 
			
		||||
Return `null` instead.
 | 
			
		||||
 | 
			
		||||
**Example (bad)**:
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user