simple-text-search

1.2.0 • Public • Published

simple-text-search

Greenkeeper badge

Usage

  var filter = require('simple-text-search')
  var get = filter(['foo', 'bar', 'foobar'])
  var results = get('foo')
  // -> returns ['foo', 'foobar']

Objects in a collection get stringified. So all properties get filtered. You can also define a property to filter in:

  var cities = [{id: 1, name: 'Zürich'}, {id: 2, name: 'Reykjavík'}]
  var get = filter(cities, 'name')
  var results = get('zurich')
  // -> returns [{id: 1, name: 'Zürich'}]

This module doesn't do any stemming except replacing umlauts.

Alternatives

Please use sifter if you need sorting or scoring.

Package Sidebar

Install

npm i simple-text-search

Weekly Downloads

829

Version

1.2.0

License

MIT

Unpacked Size

9.61 kB

Total Files

7

Last publish

Collaborators

  • marcbachmann