2.0.0 • Published 2 years ago

@codewell/super-search v2.0.0

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

@codewell/super-search

Search in javascript objects with strings

Installation

npm install @codewell/super-search

Basic usage

import { superSearch } from '@codewell/super-search';

const options = {
  // Characters that should be ignored in the search object
  // Defaults to []
  ignore: [" "],
  
  // If the search should be case sensitive
  // defaults to false
  caseSensitive: false,
};

superSearch()('foo 123', { name: 'foo', age: 123 });
// => { numberOfMatches: 2, fullMatch: false }

superSearch({ignore: [" "]})('foo', { key: 'f o o' });
// => { numberOfMatches: 1, fullMatch: true }

superSearch({caseSensitive: true})('Foo', { key: 'foo' });
// => { numberOfMatches: 0, fullMatch: false }