@orchidjs/sifter 0.9.3 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/dist/cjs/sifter.js +776 -49
- package/dist/cjs/sifter.js.map +1 -1
- package/dist/esm/lib/sifter.js +368 -0
- package/dist/esm/lib/sifter.js.map +1 -0
- package/dist/{cjs → esm/lib}/utils.js +5 -24
- package/dist/esm/lib/utils.js.map +1 -0
- package/dist/esm/node_modules/@orchidjs/unicode-variants/dist/esm/index.js +508 -0
- package/dist/esm/node_modules/@orchidjs/unicode-variants/dist/esm/index.js.map +1 -0
- package/dist/esm/node_modules/@orchidjs/unicode-variants/dist/esm/regex.js +113 -0
- package/dist/esm/node_modules/@orchidjs/unicode-variants/dist/esm/regex.js.map +1 -0
- package/dist/esm/node_modules/@orchidjs/unicode-variants/dist/esm/strings.js +29 -0
- package/dist/esm/node_modules/@orchidjs/unicode-variants/dist/esm/strings.js.map +1 -0
- package/dist/esm/sifter.js +32 -36
- package/dist/esm/sifter.js.map +1 -1
- package/dist/esm/utils.js +3 -12
- package/dist/esm/utils.js.map +1 -1
- package/dist/types/sifter.d.ts +14 -7
- package/dist/types/types.d.ts +8 -7
- package/dist/types/utils.d.ts +2 -6
- package/dist/umd/sifter.js +1101 -638
- package/dist/umd/sifter.js.map +1 -1
- package/dist/umd/sifter.min.js +110 -78
- package/dist/umd/sifter.min.js.map +1 -1
- package/lib/sifter.ts +41 -45
- package/lib/types.ts +14 -10
- package/lib/utils.ts +4 -14
- package/package.json +5 -2
- package/dist/cjs/diacritics.js +0 -182
- package/dist/cjs/diacritics.js.map +0 -1
- package/dist/cjs/utils.js.map +0 -1
- package/dist/esm/diacritics.js +0 -173
- package/dist/esm/diacritics.js.map +0 -1
- package/dist/types/diacritics.d.ts +0 -35
- package/lib/diacritics.ts +0 -196
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
Sifter is a fast and small (<6kb) client and server-side library (coded in TypeScript and available in [CJS, UMD, and ESM](https://irian.to/blogs/what-are-cjs-amd-umd-and-esm-in-javascript/)) for textually searching arrays and hashes of objects by property – or multiple properties. It's designed specifically for autocomplete. The process is three-step: *score*, *filter*, *sort*.
|
|
7
7
|
|
|
8
|
-
* **Supports díåcritîçs.**<br>For example, if searching for "montana" and an item in the set has a value of "montaña", it will still be matched. Sorting will also play nicely with diacritics.
|
|
8
|
+
* **Supports díåcritîçs.**<br>For example, if searching for "montana" and an item in the set has a value of "montaña", it will still be matched. Sorting will also play nicely with diacritics. (using [unicode-variants](https://github.com/orchidjs/unicode-variants))
|
|
9
9
|
* **Smart scoring.**<br>Items are scored / sorted intelligently depending on where a match is found in the string (how close to the beginning) and what percentage of the string matches.
|
|
10
10
|
* **Multi-field sorting.**<br>When scores aren't enough to go by – like when getting results for an empty query – it can sort by one or more fields. For example, sort by a person's first name and last name without actually merging the properties to a single string.
|
|
11
11
|
* **Nested properties.**<br>Allows to search and sort on nested properties so you can perform search on complex objects without flattening them simply by using dot-notation to reference fields (ie. `nested.property`).
|
|
@@ -20,6 +20,8 @@ $ npm install @orchidjs/sifter # node.js
|
|
|
20
20
|
## Usage
|
|
21
21
|
|
|
22
22
|
```js
|
|
23
|
+
import {Sifter} from '@orchidjs/sifter';
|
|
24
|
+
|
|
23
25
|
var sifter = new Sifter([
|
|
24
26
|
{title: 'Annapurna I', location: 'Nepal', continent: 'Asia'},
|
|
25
27
|
{title: 'Annapurna II', location: 'Nepal', continent: 'Asia'},
|