An open API service indexing awesome lists of open source software.

https://github.com/codewell/super-search

Search in an object with a string
https://github.com/codewell/super-search

Last synced: 11 months ago
JSON representation

Search in an object with a string

Awesome Lists containing this project

README

          

# @codewell/super-search

Search in javascript objects with strings

## Installation

```JavaScript
npm install @codewell/super-search
```

## Basic usage

```JavaScript
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 }
```