🚀 Socket Launch Week 🚀 Day 5: Introducing Socket Fix.Learn More
Socket
Sign inDemoInstall
Socket

googlish

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

googlish

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

0.0.8
latest
Source
npm
Version published
Weekly downloads
4
-63.64%
Maintainers
1
Weekly downloads
 
Created
Source

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']

FAQs

Package last updated on 21 Sep 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts