1.0.5 • Published 3 years ago
@dizmo/functions-filter v1.0.5
@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
npm install @dizmo/functions-filter --saveRequire
const { filter } = require('@dizmo/functions-filter');Examples
import { filter } from "@dizmo/functions-filter";const even_numbers = await filter([0,1,2,3,4], (n) => new Promise(
(resolve) => setTimeout(() => resolve(n % 2 === 0))
));const odd_numbers = await filter([0,1,2,3,4], (n) => new Promise(
(resolve) => setTimeout(() => resolve(n % 2 === 1))
));Development
Clean
npm run cleanBuild
npm run buildwithout linting and cleaning:
npm run -- build --no-lint --no-cleanwith UMD bundling (incl. minimization):
npm run -- build --prepackwith UMD bundling (excl. minimization):
npm run -- build --prepack --no-minifyLint
npm run lintwith auto-fixing:
npm run -- lint --fixTest
npm run testwithout linting, cleaning and (re-)building:
npm run -- test --no-lint --no-clean --no-buildCover
npm run coverwithout linting, cleaning and (re-)building:
npm run -- cover --no-lint --no-clean --no-buildDocumentation
npm run docsPublication
npm publishinitially (if public):
npm publish --access=publicCopyright
© 2020 dizmo AG, Switzerland