1.0.0 • Published 10 years ago

matching v1.0.0

Weekly downloads
5
License
MIT
Repository
github
Last release
10 years ago

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