# a-mapper

> async mapper,solve async map foreach reduce

Latest version **1.0.2** (published 2020-06-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install a-mapper
pnpm add a-mapper
yarn add a-mapper
bun add a-mapper
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2020-06-28 |
| First published | 2020-06-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=10 |
| Dependencies | 0 |
| Unpacked size | 12.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | thecatshidog |
| Maintainers | thecatshidog |

## Links

- npm: https://www.npmjs.com/package/a-mapper
- npm.io page: https://npm.io/package/a-mapper

## Recent versions

- 1.0.2 (latest) — 2020-06-28
- 1.0.1 — 2020-06-26
- 1.0.0 — 2020-06-26

## README

# a-mapper

> a-mapper is a npm package,use typescript write.solve foreach map filter reduce and so on not async await.

## install

```
npm install a-mapper
```

## usage

```
const asyncMap = require('a-mapper');
import asyncMap from 'a-mapper';
import { asyncMap } from 'a-mapper';
```

```
asyncMap([1, 2, 3, 4], async (item) => {
    await sleep(1000);
    return 1;
}).then((res) => {
    console.log(res); // [1, 1, 1, 1]
});
```

```
async function main() {
  await sleep("asdf");
  await asyncMap<any>(asyncItems, async (item: any) => {
    await sleep(item);
    return 1;
  });
  console.log("hello");
}
main(); // asdf 1 2 3 4 hello
```

asyncMap can execute all list length function, be not equal to filter array function

```
async function main(){
  const res = await asyncMap(list, async (item) => {
    if(item < 2) {
      return item;
    }
  });
  console.log(res); // [1, undefined, undefined, undefined]
}
```

---
_Source: https://npm.io/package/a-mapper · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
