::some()
Array.some
for iterables.
Installation
$ npm install iterable-some
Usage
; // or:const some = ;
These are all true
:
true::; false null 0 'truthy'::; 5 ::; 2 'nope' 5 'yup' ::;
– and these are false
:
false false::; ::; 3 1 0 4 ::;
::some()
is lazy – just as Array.some
. It stops executing the condition
as soon as it finds one match:
0 1 'not checked'::;
It works great with trine-style libraries:
; null undefined 0 NaN::;//» false
Huh?
If you’re wondering what the ::
thing means, you’d better read this excellent overview by @jussi-kalliokoski or have a look at the function bind syntax proposal.