npm.io
1.0.0 • Published 12 years ago

matching

Licence
MIT
Version
1.0.0
Deps
0
Vulns
0
Weekly
0

Build Status

Tiny utility to filter lists by example

Example:

var matching = require('matching');

var list = [
  { type: 'foo', foo: 23 },
  { type: 'foo', foo: 42 },
  { type: 'bar', bar: 23 }
];

var foo = matching({ type: 'foo' }, list);
// => [ { type: 'foo', foo: 23 }, { type: 'foo', foo: 42 } ]

About

This package has been written to accompany tools like flatten, uniqs or intersect as simple and lightweight alternative to utility collections like underscore or lodash where you could achieve the same result like this:

_.where(list, {type: 'foo'});

The order of the arguments has been reveresed to allow currying.

License

MIT

Keywords