Where
21 July 2014
After reading a friend’s article about constraint notation, I realized I need this… for things.
With prior authorization and a promise to give the due props, I sucked this functionality out of Ramda
and re-wrote it without any dependencies, here. The pattern of parsing a spec
object for later comparison works great in native Array.filter()
or in object streams–like
when using highland.js.
//obligatory declarations
var where = require( 'where-filter' );
var isComplete = where( {complete: true} );
// ...
tasks.filter( isComplete );
// or this
highland( tasks ).filter( isComplete ).toArray( function ( filtered ) {
//...
} );