is.js - Adding clarity and conciseness to your JS through predicates
is.js
is a predicate library for JS. is
doesn't have any dependencies which makes it easy to integrate into new and existing projects.
Docs
install
npm install --save is-predicate
or
download the file from the dist directory
Usage
is; // trueisnot; // trueis; // foois; // trueisnot; // true
Every/Some
Every and some are functions that allow you to chain predicate calls. The calls are not evaluated until .val()
is executed on the chain.
// All evaluations must be trueis; // trueisall; // false // At least one eval must be trueis; // trueis; // trueis; // false
Alternaively to .val
you can execute valueOf
// All evaluations must be true!!is; // true
Notice the alias of
all/any
if you prefer that flavor
NOTE: Chaining doesnt work with
.not
yet.
Author
contributing
- Suggestions welcome!
- Tests!
- Ping me on twitter if I take too long to respond! That probably means I missed the alert/email.
Tests
To run tests, install devDeps and type npm ts
Building
To build, type npm run build
.
This will create a UMDified version of is in the dist
directory along with a minified version.