1.0.4 • Published 2 years ago

string-match-like-search-engines v1.0.4

Weekly downloads
1
License
MIT
Repository
-
Last release
2 years ago

string-match-like-search-engines

Google/Bing search style string matching.

Install

yarn add string-match-like-search-engines

Use

import stringMatch from 'string-match-like-search-engines'

// stringMatch(stringToCheck, pattern, options)
stringMatch('A good day for hot dogs and smoothies', 'hot dogs') // returns true
stringMatch('A good day for hot dogs and smoothies', 'dog hot') // returns true
stringMatch('A good day for hot dogs and smoothies', 'hot cats') // returns false
stringMatch('A good day for hot dogs and smoothies', '"hot dogs" smoothies -burgers -"cold beer"') // returns true

Notes:

  • If pattern is not a string, stringMatch just return truthiness of pattern.

Options

defaultOptions = {
  stringDelimiter: '"',
  caseSensitive: false
}

Run tests

yarn test
1.0.4

2 years ago

1.0.3

4 years ago

1.0.2

5 years ago

1.0.1

6 years ago

1.0.0

6 years ago