array-where
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

Background

I often mix up the filtering of arrays because I put in what I want to filter out into the predicate, because that's what filtering should be.

So this library is purely to add a better named extension method that just forwards the parameters to the this.filter() so you don't need to worry about mixing it up again.

For further reading on the underlying .filter() functionality, see the MDN docs.

Install

Using NPM:

npm install array-where

Then, it can be imported with:

import 'array-where'

Usage

For flat values:

[1, 2, 3].where(x => x > 1)

For objects:

[{ value: 1 }, { value: 2 }, { value: 3 },].where(item => item.value > 1)

Package Sidebar

Install

npm i array-where

Weekly Downloads

1

Version

1.0.1

License

ISC

Unpacked Size

7.55 kB

Total Files

7

Last publish

Collaborators

  • blake9201