https://github.com/dizmo/functions-filter
dizmoFun: asynchronous array filter
https://github.com/dizmo/functions-filter
array asynchronous dizmo filter function javascript library typescript
Last synced: about 2 months ago
JSON representation
dizmoFun: asynchronous array filter
- Host: GitHub
- URL: https://github.com/dizmo/functions-filter
- Owner: dizmo
- License: isc
- Created: 2020-10-05T17:35:20.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2022-11-16T19:21:28.000Z (over 3 years ago)
- Last Synced: 2025-10-03T06:32:10.420Z (9 months ago)
- Topics: array, asynchronous, dizmo, filter, function, javascript, library, typescript
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/@dizmo/functions-filter
- Size: 593 KB
- Stars: 0
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://npmjs.org/package/@dizmo/functions-filter)
[](https://travis-ci.com/dizmo/functions-filter)
[](https://coveralls.io/github/dizmo/functions-filter?branch=master)
# @dizmo/functions-filter
Asynchronously filters an array of items: The `Array.prototype.filter` function does *not* allow to filter an array using asynchronous predicates. However by applying the `filter` function, it becomes possible to do so.
## Usage
### Installation
```sh
npm install @dizmo/functions-filter --save
```
### Require
```javascript
const { filter } = require('@dizmo/functions-filter');
```
### Examples
```typescript
import { filter } from "@dizmo/functions-filter";
```
```typescript
const even_numbers = await filter([0,1,2,3,4], (n) => new Promise(
(resolve) => setTimeout(() => resolve(n % 2 === 0))
));
```
```typescript
const odd_numbers = await filter([0,1,2,3,4], (n) => new Promise(
(resolve) => setTimeout(() => resolve(n % 2 === 1))
));
```
## Development
### Clean
```sh
npm run clean
```
### Build
```sh
npm run build
```
#### without linting and cleaning:
```sh
npm run -- build --no-lint --no-clean
```
#### with UMD bundling (incl. minimization):
```sh
npm run -- build --prepack
```
#### with UMD bundling (excl. minimization):
```sh
npm run -- build --prepack --no-minify
```
### Lint
```sh
npm run lint
```
#### with auto-fixing:
```sh
npm run -- lint --fix
```
### Test
```sh
npm run test
```
#### without linting, cleaning and (re-)building:
```sh
npm run -- test --no-lint --no-clean --no-build
```
### Cover
```sh
npm run cover
```
#### without linting, cleaning and (re-)building:
```sh
npm run -- cover --no-lint --no-clean --no-build
```
## Documentation
```sh
npm run docs
```
## Publication
```sh
npm publish
```
#### initially (if public):
```sh
npm publish --access=public
```
## Copyright
© 2020 [dizmo AG](http://dizmo.com/), Switzerland