@ycleptkellan/substantive
v1.0.6
Published
It may be truthy, but is it...substantive?
Downloads
3
Readme
substantive
Determine whether a given argument is both truthy and iterable.
[]
and {}
are truthy in JavaScript. By the same token, '0'
is falsy. Etc...
Accounting for these idiosyncracies can be inconvenient, so this library provides a few simple helpers. E. g.
if (this.props.list && this.props.list.length) {
// do something w/ list
}
becomes
if (substArr(this.props.list)) {
// do something w/ list
}
Install
$ npm i (-D) @ycleptkellan/substantive
API
https://ycleptkellan.github.io/substantive/