Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support Iterable objects, such as Map, Set, String #415

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
49 changes: 27 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,31 +100,31 @@ Convert sync function to Promise object

### map(items, fn, done)

- `items`: [`<Array>`][array] incoming
- `items`: [`<Iterable>`][iterable] incoming
- `fn`: [`<Function>`][function] to be executed for each value in the array
- `current`: `<any>` current element being processed in the array
- `callback`: [`<Function>`][function]
- `err`: [`<Error>`][error]|[`<null>`][null]
- `value`: `<any>`
- `done`: [`<Function>`][function] on done
- `err`: [`<Error>`][error]|[`<null>`][null]
- `result`: [`<Array>`][array]
- `result`: [`<Iterable>`][iterable]

Asynchronous map (iterate parallel)

### filter(items, fn, done)

- `items`: [`<Array>`][array] incoming
- `items`: [`<Iterable>`][iterable] incoming
- `fn`: [`<Function>`][function] to be executed for each value in the array
- `value`: `<any>` item from items array
- `callback`: [`<Function>`][function]
- `err`: [`<Error>`][error]|[`<null>`][null]
- `accepted`: [`<boolean>`][boolean]
- `done`: [`<Function>`][function] on done
- `err`: [`<Error>`][error]|[`<null>`][null]
- `result`: [`<Array>`][array]
- `result`: [`<Iterable>`][iterable]

Asynchrous filter (iterate parallel)
Asynchronous filter (iterate parallel)

_Example:_

Expand All @@ -138,7 +138,7 @@ metasync.filter(

### reduce(items, fn, done\[, initial\])

- `items`: [`<Array>`][array] incoming
- `items`: [`<Iterable>`][iterable] incoming
- `fn`: [`<Function>`][function] to be executed for each value in array
- `previous`: `<any>` value previously returned in the last iteration
- `current`: `<any>` current element being processed in the array
Expand All @@ -148,18 +148,18 @@ metasync.filter(
- `data`: `<any>` resulting value
- `counter`: [`<number>`][number] index of the current element being processed
in array
- `items`: [`<Array>`][array] the array reduce was called upon
- `done`: [`<Function>`][function] on done
- `items`: [`<Iterable>`][iterable] the array reduce was called upon
- `done`: [`<Function>`][function] on done, optional
- `err`: [`<Error>`][error]|[`<null>`][null]
- `result`: [`<Array>`][array]
- `result`: [`<Iterable>`][iterable]
- `initial`: `<any>` optional value to be used as first argument in first
iteration

Asynchronous reduce

### reduceRight(items, fn, done\[, initial\])

- `items`: [`<Array>`][array] incoming
- `items`: [`<Iterable>`][iterable] incoming
- `fn`: [`<Function>`][function] to be executed for each value in array
- `previous`: `<any>` value previously returned in the last iteration
- `current`: `<any>` current element being processed in the array
Expand All @@ -169,25 +169,25 @@ Asynchronous reduce
- `data`: `<any>` resulting value
- `counter`: [`<number>`][number] index of the current element being processed
in array
- `items`: [`<Array>`][array] the array reduce was called upon
- `done`: [`<Function>`][function] on done
- `items`: [`<Iterable>`][iterable] the array reduce was called upon
- `done`: [`<Function>`][function] on done, optional
- `err`: [`<Error>`][error]|[`<null>`][null]
- `result`: [`<Array>`][array]
- `result`: [`<Iterable>`][iterable]
- `initial`: `<any>` optional value to be used as first argument in first
iteration

Asynchronous reduceRight

### each(items, fn, done)

- `items`: [`<Array>`][array] incoming
- `items`: [`<Iterable>`][iterable] incoming
- `fn`: [`<Function>`][function]
- `value`: `<any>` item from items array
- `callback`: [`<Function>`][function]
- `err`: [`<Error>`][error]|[`<null>`][null]
- `done`: [`<Function>`][function] on done
- `err`: [`<Error>`][error]|[`<null>`][null]
- `items`: [`<Array>`][array]
- `items`: [`<Iterable>`][iterable]

Asynchronous each (iterate in parallel)

Expand All @@ -206,14 +206,14 @@ metasync.each(

### series(items, fn, done)

- `items`: [`<Array>`][array] incoming
- `items`: [`<Iterable>`][iterable] incoming
- `fn`: [`<Function>`][function]
- `value`: `<any>` item from items array
- `callback`: [`<Function>`][function]
- `err`: [`<Error>`][error]|[`<null>`][null]
- `done`: [`<Function>`][function] on done
- `err`: [`<Error>`][error]|[`<null>`][null]
- `items`: [`<Array>`][array]
- `items`: [`<Iterable>`][iterable]

Asynchronous series

Expand All @@ -234,7 +234,7 @@ metasync.series(

### find(items, fn, done)

- `items`: [`<Array>`][array] incoming
- `items`: [`<Iterable>`][iterable] incoming
- `fn`: [`<Function>`][function]
- `value`: `<any>` item from items array
- `callback`: [`<Function>`][function]
Expand All @@ -260,7 +260,7 @@ metasync.find(

### every(items, fn, done)

- `items`: [`<Array>`][array] incoming
- `items`: [`<Iterable>`][iterable] incoming
- `fn`: [`<Function>`][function]
- `value`: `<any>` item from items array
- `callback`: [`<Function>`][function]
Expand All @@ -274,7 +274,7 @@ Asynchronous every

### some(items, fn, done)

- `items`: [`<Array>`][array] incoming
- `items`: [`<Iterable>`][iterable] incoming
- `fn`: [`<Function>`][function]
- `value`: `<any>` item from items array
- `callback`: [`<Function>`][function]
Expand All @@ -288,7 +288,7 @@ Asynchronous some (iterate in series)

### asyncMap(items, fn\[, options\]\[, done\])

- `items`: [`<Array>`][array] incoming dataset
- `items`: [`<Iterable>`][iterable] incoming dataset
- `fn`: [`<Function>`][function]
- `item`: `<any>`
- `index`: [`<number>`][number]
Expand All @@ -297,7 +297,7 @@ Asynchronous some (iterate in series)
- `percent`: [`<number>`][number] ratio of map time to all time
- `done`: [`<Function>`][function] call on done, optional
- `err`: [`<Error>`][error]|[`<null>`][null]
- `result`: [`<Array>`][array]
- `result`: [`<Iterable>`][iterable]

Non-blocking synchronous map

Expand Down Expand Up @@ -332,6 +332,8 @@ Create an AsyncIterator instance

#### async AsyncIterator.prototype.reduce(reducer, initialValue)

#### async AsyncIterator.prototype.reduceRight(reducer, initialValue)

#### async AsyncIterator.prototype.some(predicate, thisArg)

#### async AsyncIterator.prototype.someCount(predicate, count, thisArg)
Expand Down Expand Up @@ -366,6 +368,8 @@ Create an AsyncIterator instance

#### AsyncIterator.prototype.enumerate()

#### AsyncIterator.prototype.reverse()

### collect(expected)

- `expected`: [`<number>`][number]|[`<string[]>`][string]
Expand Down Expand Up @@ -867,6 +871,7 @@ Set timeout for asynchronous function execution
- Timur Shemsedinov (marcusaurelius)
- See github for full [contributors list](https://github.com/metarhia/metasync/graphs/contributors)

[iterable]: https://tc39.es/ecma262/#sec-iterable-interface
[asynciterable]: https://tc39.github.io/ecma262/#sec-asynciterable-interface
[asynciterator]: #class-asynciterator
[collector]: #class-collector
Expand Down