Skip to content

Typescript implementation of Scala's withFilter function

Notifications You must be signed in to change notification settings

brapifra/with-filter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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]

About

Typescript implementation of Scala's withFilter function

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published