like

build a regex from user input for filtering data

like

build a regex from user input for filtering data

$ npm install like
var like = require('like')
 
var filter = like(searchField.value)
 
var matches = items.filter(function (x) {
  return filter.test(x)
})
 
// or we could get a predicate function like so: 
 
var matches = items.filter(like.fn(searchField.value))

note As of 0.3.0, matches are case-sensitive by default. Functions take an options parameter which takes a ignoreCase option. Example:

like('foo', {ignoreCase: true})

Described using jsig:

type Predicate : (Value) => Boolean

$ git clone git@github.com:AgileDiagnosis/like.git && cd like
$ npm install
$ npm test

substack for quotemeta

jden jason@denizac.org

MIT. (c) 2013 Agile Diagnosis hello@agilediagnosis.com. See LICENSE.md