Phuzzy

phuzzy

Perform a fuzzy filter on a collection of items.

8 lines of code with some help from lodash.escaperegexp this is a cheeky module that helps you with your fuzzy filtering!

Get it: npm install --save phuzzy

Function Signature: phuzzy(collection, search[, pick])

Sample usage:

1
2
3
4
5
6
7
8
9
10
11
12
13
var phuzzy = require('phuzzy');

phuzzy(['addy','passy', 'hemanth'], 'y'); // ['addy', 'passy'];

var documents = [
    { text: 'Hello World' },
    { text: 'Hello Lucy' },
    { text: 'Hello Maria' }
];

phuzzy(documents, 'Lu', 'text'); [ { text: 'Hello Lucy' } ]

phuzzy(documents, 'maria', item => item.text) // [ { text: 'Hello Maria' } ]

GIF FTW!

phuzzy

Suggest a module

Comments