Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wangcch/async-array
array asynchronous loop
https://github.com/wangcch/async-array
Last synced: 24 days ago
JSON representation
array asynchronous loop
- Host: GitHub
- URL: https://github.com/wangcch/async-array
- Owner: wangcch
- License: mit
- Created: 2019-07-30T08:05:40.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-10-02T20:33:46.000Z (over 1 year ago)
- Last Synced: 2024-12-07T21:33:59.622Z (about 1 month ago)
- Language: TypeScript
- Size: 799 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Async-Array
array asynchronous loop
[![Build Status](https://travis-ci.org/wangcch/async-array.svg?branch=master)](https://travis-ci.org/wangcch/async-array)
[![](https://img.shields.io/npm/v/@wangcch/async-array.svg)](https://www.npmjs.com/package/@wangcch/async-array)
[![](https://img.shields.io/npm/l/@wangcch/async-array.svg)](./LICENSE)## usage
```shell
yarn add @wangcch/async-array
``````
# install dependencies
yarn# build for production with minification
yarn build# test
yarn test
```### example
```jsx
import {
filterAsync,
mapAsync,
forEachAsync,
someAsync,
everyAsync,
} from "@wangcch/async-array";
``````ts
// filterAsync
const result = await filterAsync([1, 2, 3], async i => i > 2);
// [3]
``````ts
// mapAsync
const result = await mapAsync([1, 2, 3], async i => i * 2);
// [2, 4, 6]
``````ts
// forEachAsync
let arr: number[] = [];
await forEachAsync([1, 2, 3], async i => {
arr.push(i * 2);
});return arr;
// [2, 4, 6]
``````ts
// someAsync
const result = await someAsync([1, 2, 3], async i => i > 2);
// true
``````ts
// everyAsync
const result = await everyAsync([1, 2, 3], async i => i > 2);
// false
```## workflow
https://github.com/wangcch/ts-npm-workflow
## license
[MIT](./LICENSE)