2.1.1 • Published 3 years ago

nanofilters v2.1.1

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

Nano Filters

Tiny (<3Kb) array filters lib with both ESM and CJS support:

const arr = [1, "2", { arg: 3 }, [4], null, undefined];

truthy(arr); // excludes false, 0, null, undefined, ''

head(arr, 1); // gets N head elements

tail(arr, 2); // gets N tail elements

objects(arr); // selects objects
objects.plain(arr); // selects only plain objects (null proto or Object.prototype)

vals(arr); // excludes null and undefined

instances(arr, C); // selects only instances of C

bools(arr); // selects only true, false and instances of Boolean

nums(arr); // selects numbers excluding Infinites and NaN

strings(arr); // selects strings only

// Some functions have 'not' postfix buddy:

truthy.not(arr); // excludes truthy
nums.not(arr); // excludes numbers
// etc...

https://www.npmjs.com/package/nanofilters

2.1.1

3 years ago

2.1.0

3 years ago

2.0.0

3 years ago

1.3.2

4 years ago

1.3.1

4 years ago

1.3.0

4 years ago

1.2.1

4 years ago

1.2.0

4 years ago

1.1.0

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago