0.0.8 • Published 8 years ago

googlish v0.0.8

Weekly downloads
19
License
ISC
Repository
github
Last release
8 years ago

Googlish

Enter a Google search style query and it will return a test function that returns true when its input satisfies the query.

Works with double and single quoted inner strings:

const test = googlish('over fox "lazy dog"')
test('the quick brown fox jumps over the lazy dog')
//true

const test = googlish('over fox "dog lazy"')
test('the quick brown fox jumps over the lazy dog')
//false

By default substrings count as matches and search is case insensitive. This can be changed:

let wholeWords = true
let caseSensitive = true
googlish('over fox', wholeWords, caseSensitive)

Ideal for creating filter functions:

const isLazyDog = googlish('"lazy dog"')
const dogs = ['happy dog', 'lazy dog']
const lazyDogs = dogs.filter(isLazyDog)
// ['lazy dog']
0.0.8

8 years ago

0.0.6

8 years ago

0.0.5

8 years ago

0.0.4

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago