Skip to content

Commit ea808af

Browse files
authored
Merge pull request #26 from Sykander/develop
Release 1.0.1
2 parents 87d442f + 33e1468 commit ea808af

File tree

3 files changed

+53
-63
lines changed

3 files changed

+53
-63
lines changed

README.md

Lines changed: 39 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,82 +1,63 @@
1-
# Iterable Async Methods
1+
# Iterable Async Methods
2+
[![Try iterable-async on RunKit](https://badge.runkitcdn.com/iterable-async.svg)](https://npm.runkit.com/iterable-async)
23

3-
## Async Map
4+
A collection of methods for looping iterable objects asynchronously using something similar to the Array api.
45

6+
## Installation
7+
8+
```
9+
$ npm install iterable-async
510
```
6-
/**
11+
12+
## Methods
13+
14+
* Async Filter
15+
* Async Find
16+
* Async Find Index
17+
* Async For Each
718
* Async Map
8-
* Map an array asynchronously and resolve when all callbacks are resolved
9-
* Will map independently from order when callbacks are async
10-
* @async
11-
* @param {Function} callback - callback(currentValue, index, array)
12-
* @param {Object} [thisArg] - must be iterable
13-
* @return {Array}
14-
* @throws {TypeError}
15-
*/
16-
function asyncMap(callback, [thisArg]) {...}
19+
20+
### Async Filter
21+
22+
Filter an iterable object asynchronously
23+
```
24+
function asyncFilter(callback, [thisArg]) {...}
1725
```
1826

19-
## Async For Each
27+
### Async Find
2028

29+
Find an item in an iterable object asynchronously
2130
```
22-
/**
23-
* Async For Each
24-
* Loop over an array asynchronously and resolve when all callbacks are resolved
25-
* Will loop independently from order when callbacks are async
26-
* @async
27-
* @param {Function} callback - callback(currentValue, index, array)
28-
* @param {Object} [thisArg] - must be iterable
29-
* @throws {TypeError}
30-
*/
31-
function asyncForEach(callback, [thisArg]) {...}
31+
function asyncFind(callback, [thisArg]) {...}
3232
```
3333

34-
## Async Filter
34+
### Async Find Index
3535

36+
Find an item's index in an iterable object asynchronously
3637
```
37-
/**
38-
* Async Filter
39-
* Filter an iterable object asynchronously and resolve when all callbacks are resolved
40-
* @async
41-
* @param {Function} callback - callback(currentValue, index, array)
42-
* @param {Object} [thisArg] - must be iterable
43-
* @return {Array}
44-
* @throws {TypeError}
45-
*/
46-
function asyncFilter(callback, [thisArg]) {...}
38+
async function asyncFindIndex(callback, [thisArg]) {...}
4739
```
4840

49-
## Async Find
41+
### [Async For Each](https://github.com/Sykander/iterable-async/wiki/Async-For-Each)
5042

43+
Loop over an iterable object asynchronously
5144
```
52-
/**
53-
* Async Find
54-
* Find an item in an iterable object asynchronously and resolve when found or all callbacks resolve
55-
* @async
56-
* @param {Function} callback - callback(currentValue, index, array)
57-
* @param {Object} [thisArg] - must be iterable
58-
* @return {any}
59-
* @throws {TypeError}
60-
*/
45+
function asyncForEach(callback, [thisArg]) {...}
6146
```
6247

63-
## Async Find Index
48+
### Async Map
6449

50+
Map an iterable object asynchronously
6551
```
66-
/**
67-
* Async Find Index
68-
* Find an item's index in an iterable object asynchronously and resolve when found or all callbacks resolve
69-
* @async
70-
* @param {Function} callback - callback(currentValue, index, array)
71-
* @param {Object} [thisArg] - must be iterable
72-
* @return {Number} - an integer index, -1 if not found
73-
* @throws {TypeError}
74-
*/
52+
function asyncMap(callback, [thisArg]) {...}
7553
```
7654

77-
# Development
7855

79-
## Scripts
56+
## Development
57+
58+
Development is open to contribution, check the project board "Development" for tickets.
59+
60+
### Scripts
8061

8162
```
8263
npm run lint
@@ -92,6 +73,6 @@ npm test
9273
# Runs all tests
9374
```
9475

95-
## Commit Rules
76+
### Commit Rules
9677

97-
* All commits should pass the lint check commandS
78+
* All commits should pass the lint check commands

docs/playground.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
const {
2+
asyncFind,
3+
asyncFindIndex,
4+
asyncFilter,
5+
asyncForEach,
6+
asyncMap
7+
} = require('iterable-async');

package.json

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,18 @@
55
"main": "src",
66
"scripts": {
77
"test": "./node_modules/.bin/mocha test",
8-
"lint:fix": "./node_modules/.bin/eslint src test --fix && ./node_modules/.bin/prettier --write 'src/**/*.{js,ts,css,html}' --write 'test/**/*.{js,ts,css,html}'",
8+
"lint:fix": "./node_modules/.bin/prettier --write 'src/**/*.{js,ts,css,html}' --write 'test/**/*.{js,ts,css,html}' --write 'docs/**/*.{js,ts,css,html}'",
99
"lint:check": "./node_modules/.bin/eslint src test",
10-
"lint": "npm run lint:fix && npm run lint:check"
10+
"lint": "npm run lint:fix && npm run lint:check",
11+
"prepublishOnly": "npm run lint:check && npm test"
1112
},
1213
"author": {
1314
"name": "Sykander Gul",
1415
"email": "scanda@live.co.uk"
1516
},
1617
"repository": {
17-
"type" : "git",
18-
"url" : "https://github.com/Sykander/patterns.git"
18+
"type": "git",
19+
"url": "https://github.com/Sykander/iterable-async.git"
1920
},
2021
"license": "MIT",
2122
"devDependencies": {
@@ -33,5 +34,6 @@
3334
"hooks": {
3435
"pre-commit": "npm run lint:check"
3536
}
36-
}
37+
},
38+
"runkitExampleFilename": "docs/playground.js"
3739
}

0 commit comments

Comments
 (0)