1.0.0 • Published 4 years ago

with-filter v1.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

with-filter

Typescript implementation of Scala's withFilter function

Installation

npm install with-filter

or

yarn add with-filter

Usage

It can be imported

import withFilter from "with-filter";

withFilter([1, 2, 3], value => value % 2 !== 0)
  .withFilter(value => value > 1)
  .map(value => value * 2);
// Returns [6]

const arrayWithFilters = withFilter([1, 2, 3]);

arrayWithFilters(value => value % 2 !== 0)
  .withFilter(value => value > 1)
  .map(value => value * 2);
// Returns [6]

or added to the prototype of Array:

import "with-filter/dist/extend-array-prototype";

[1, 2, 3]
  .withFilter(value => value % 2 !== 0)
  .withFilter(value => value > 1)
  .map(value => value * 2);
// Returns [6]
1.0.0

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago