|
1 | 1 | # Iterable Async Methods
|
2 | 2 | [](https://npm.runkit.com/iterable-async)
|
| 3 | +[](https://github.com/Sykander/iterable-async/wiki) |
| 4 | +[](https://snyk.io/test/github/Sykander/iterable-async?targetFile=package.json) |
3 | 5 |
|
4 | 6 | A collection of methods for looping iterable objects asynchronously using something similar to the Array api.
|
5 | 7 |
|
6 | 8 | ## Installation
|
7 | 9 |
|
8 | 10 | ```
|
9 |
| -$ npm install iterable-async |
| 11 | + $ npm install iterable-async |
10 | 12 | ```
|
11 | 13 |
|
12 |
| -## Objects |
| 14 | +## Usage |
13 | 15 |
|
14 |
| -* Async Array |
| 16 | +***ES6 Format*** |
15 | 17 |
|
16 |
| -### Async Array |
17 |
| - |
18 |
| -An Array class with additional async array methods. |
19 |
| -``` |
20 |
| -class AsyncArray extends Array {...} |
21 |
| -``` |
22 |
| - |
23 |
| -## Methods |
24 |
| - |
25 |
| -* Async Filter |
26 |
| -* Async Find |
27 |
| -* Async Find Index |
28 |
| -* Async For Each |
29 |
| -* Async Map |
30 |
| -* Async Sort |
31 |
| - |
32 |
| -### [Async Filter](https://github.com/Sykander/iterable-async/wiki/Async-Filter) |
33 |
| - |
34 |
| -Filter an iterable object asynchronously |
35 |
| -``` |
36 |
| -async function asyncFilter(callback, [thisArg]) {...} |
| 18 | +``` js |
| 19 | +const AsyncArray = require('iterable-async'); |
37 | 20 | ```
|
38 | 21 |
|
39 |
| -### [Async Find](https://github.com/Sykander/iterable-async/wiki/Async-Find) |
| 22 | +***TypeScript Format*** |
40 | 23 |
|
41 |
| -Find an item in an iterable object asynchronously |
42 |
| -``` |
43 |
| -async function asyncFind(callback, [thisArg]) {...} |
44 |
| -``` |
45 |
| - |
46 |
| -### [Async Find Index](https://github.com/Sykander/iterable-async/wiki/Async-Find-Index) |
47 |
| - |
48 |
| -Find an item's index in an iterable object asynchronously |
49 |
| -``` |
50 |
| -async function asyncFindIndex(callback, [thisArg]) {...} |
| 24 | +``` ts |
| 25 | +import * as AsyncArray from "iterable-async"; |
51 | 26 | ```
|
52 | 27 |
|
53 |
| -### [Async For Each](https://github.com/Sykander/iterable-async/wiki/Async-For-Each) |
| 28 | +## Async Array |
54 | 29 |
|
55 |
| -Loop over an iterable object asynchronously |
56 |
| -``` |
57 |
| -async function asyncForEach(callback, [thisArg]) {...} |
58 |
| -``` |
| 30 | +An Array class with additional async array methods. |
59 | 31 |
|
60 |
| -### [Async Map](https://github.com/Sykander/iterable-async/wiki/Async-Map) |
| 32 | +### Methods |
61 | 33 |
|
62 |
| -Map an iterable object asynchronously |
63 |
| -``` |
64 |
| -async function asyncMap(callback, [thisArg]) {...} |
65 |
| -``` |
66 |
| - |
67 |
| -### [Async Sort](https://github.com/Sykander/iterable-async/wiki/Async-Sort) |
68 |
| - |
69 |
| -Sort an iterable object asynchronously |
70 |
| -``` |
71 |
| -async function asyncSort(callback) {...} |
72 |
| -``` |
| 34 | +| Method | Description | Wiki | |
| 35 | +| -- | -- | -- | |
| 36 | +| **asyncFilter** | Filter an iterable object asynchronously. | [wiki](https://github.com/Sykander/iterable-async/wiki/Async-Filter) | |
| 37 | +| **asyncFind** | Find an item in an iterable object asynchronously | [wiki](https://github.com/Sykander/iterable-async/wiki/Async-Filter) | |
| 38 | +| **asyncFindIndex** | Find an item's index in an iterable object asynchronously | [wiki](https://github.com/Sykander/iterable-async/wiki/Async-Find-Index) | |
| 39 | +| **asyncForEach** | Loop over an iterable object asynchronously | [wiki](https://github.com/Sykander/iterable-async/wiki/Async-For-Each) | |
| 40 | +| **asyncMap** | Map an iterable object asynchronously | [wiki](https://github.com/Sykander/iterable-async/wiki/Async-Map) | |
| 41 | +| **asyncMapSort** | Map an iterable object asynchronously and then resolve when it's sorted, this method is much more efficient than running a regular `asyncSort` when done with a synchronous comparison function | [wiki](https://github.com/Sykander/iterable-async/wiki/Async-Map-Sort) | |
| 42 | +| **asyncSort** | Sort an iterable object asynchronously | [wiki](https://github.com/Sykander/iterable-async/wiki/Async-Sort) | |
73 | 43 |
|
74 | 44 | ## Development
|
75 | 45 |
|
76 | 46 | Development is open to contribution, check the project board "Development" for tickets.
|
77 | 47 |
|
78 | 48 | ### Scripts
|
79 | 49 |
|
80 |
| -``` |
81 |
| -npm run lint |
82 |
| -# Lints the project and returns a report |
83 |
| -
|
84 |
| -npm run lint:check |
85 |
| -# Returns a report on lint issues in the project |
86 |
| -
|
87 |
| -npm run lint:fix |
88 |
| -# Fixes lint issues in the project and returns a report on the ones which couldn't be fixed |
89 |
| -
|
90 |
| -npm test |
91 |
| -# Runs all tests |
| 50 | +| Script | Description | |
| 51 | +|--|--| |
| 52 | +| lint | Lints the project and returns a report | |
| 53 | +| lint:check | Returns a report on lint issues in the project | |
| 54 | +| lint:fix | Fixes lint issues in the project and returns a report on the ones which couldn't be fixed | |
| 55 | +| test | Runs all tests and returns a report on which pass/fail | |
| 56 | +| test:unit-tests | Runs only unit tests and returns a report on which pass/fail | |
| 57 | +| test:code-style | Runs only code checks and returns a report on which pass/fail | |
| 58 | +| test:type-definitions | Attempts to compile and run a typescript file using this module | |
| 59 | +| test:coverage | Creates a testing coverage report and checks that testing meets minimum requirements | |
| 60 | +| test:coverage-report | Creates a testing coverage report | |
| 61 | +| test:coverage-check | Checks the last test coverage report to see if testing coverage meets the minimum requirements | |
| 62 | + |
| 63 | +Eg. to run all lint tests |
| 64 | +``` |
| 65 | + $ npm run lint |
92 | 66 | ```
|
93 | 67 |
|
94 | 68 | ### Commit Rules
|
|
0 commit comments