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
- Host: GitHub
- URL: https://github.com/codewell/super-search
- Owner: codewell
- Created: 2019-10-17T14:49:24.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-03-04T04:57:48.000Z (over 3 years ago)
- Last Synced: 2025-02-22T07:31:50.055Z (over 1 year ago)
- Language: JavaScript
- Size: 420 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
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 }
```