2.0.8 • Published 5 years ago

smart-table-search v2.0.8

Weekly downloads
140
License
MIT
Repository
github
Last release
5 years ago

smart-table-search

CircleCI

full text search factory: takes a configuration object and returns a function operating on arrays

basic

options

  • scope: an array with pointers to the properties to search
  • value: the value items should match
  • isCaseSensitive: whether the search should be case sensitive (default: false)

usage

import {basic} from 'smart-table-search';

const collection = [
  {a: 'woo', b: {c: 'foot'}},
  {a: 'foo', b: {c: 'w'}},
  {a: 'foo', b: {c: 'b'}},
];

const search = basic({value: 'w', scope: ['a', 'b.c']})

const output = search(collection);
// > [{"a": "woo", "b": {"c": "foot"}},{"a": "foo", "b": {"c": "w"}}]

regexp

options

  • scope: an array with pointers to the properties to search
  • value: the regex pattern items should match
  • escape: whether special regexp syntax character should be escaped (default false)
  • flags: a string with the flags to provide to the testing regexp (default '')

usage

import {regexp} from 'smart-table-search';

const collection = [
  {a: 'Woo', b: {c: 'bar'}},
  {a: 'a', b: {c: 'w'}},
  {a: 'owo', b: {c: 'bar'}}
];
const search = regexp({value: '^w', scope: ['a', 'b.c'], flags: 'i'});
const output = search(collection)
// > [ {a: 'Woo', b: {c: 'bar'}}, {a: 'a', b: {c: 'w'}}
2.0.8

5 years ago

2.0.7

5 years ago

2.0.6

6 years ago

2.0.5

6 years ago

2.0.4

6 years ago

2.0.3

6 years ago

2.0.2

6 years ago

2.0.1

6 years ago

2.0.0

6 years ago

2.0.0-1

6 years ago

2.0.0-0

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

7 years ago

1.0.0

7 years ago