1.0.10 • Published 2 years ago

search-worker v1.0.10

Weekly downloads
7
License
MIT
Repository
github
Last release
2 years ago

search-worker

Simple fast AF text search that utilizes a web worker.

This module delegates searching long lists of text to a worker thread, greatly increasing performance.

Uses "greenlet" as a dependency for inline worker threading.

Fork or clone this repo and to try out searching through 20,000+ items with no lag.

Installation

npm install search-worker

Usage

import { SearchWorker } from 'search-worker';

const originalList = [
  { name: 'lorem', foo: 'bar' },
  { name: 'ipsum', foo: 'baz' },
  { name: 'dolor', foo: 'buz' },
];

const options = { keys: ['name', 'foo'] };
// or const options = { keys: 'name,foo' };

let searchList = SearchWorker(
  originalList,
  options // you can omit these options if you are searching an array of strings ex: ['lorem','ipsum']
);

searchList('lorem')
  .then(updatedList => {
    console.log(updatedList) // [{name:'lorem', foo: 'bar'}]
  });

See the demo in this repo for usage with p/react

License

1.0.9

2 years ago

1.0.10

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.2

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago