rapid-fuzzy 0.6.0 → 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 +40 -38
- package/index.d.ts +45 -0
- package/index.js +53 -52
- package/index.mjs +2 -0
- package/objects.d.ts +6 -6
- package/objects.js +7 -2
- package/objects.mjs +2 -0
- package/package.json +36 -11
package/README.md
CHANGED
|
@@ -10,8 +10,6 @@
|
|
|
10
10
|
|
|
11
11
|
Blazing-fast fuzzy search for JavaScript — powered by Rust, works everywhere.
|
|
12
12
|
|
|
13
|
-
<img src=".github/assets/demo.svg" alt="rapid-fuzzy demo — fuzzy search, query syntax, FuzzyIndex, and string distance" width="580" />
|
|
14
|
-
|
|
15
13
|
## Features
|
|
16
14
|
|
|
17
15
|
- **Fast**: Up to 7,000x faster than fuse.js with FuzzyIndex (Rust + napi-rs)
|
|
@@ -20,6 +18,10 @@ Blazing-fast fuzzy search for JavaScript — powered by Rust, works everywhere.
|
|
|
20
18
|
- **Type-safe**: Full TypeScript support with auto-generated type definitions
|
|
21
19
|
- **Drop-in**: API compatible with popular fuzzy search libraries
|
|
22
20
|
|
|
21
|
+
## Playground
|
|
22
|
+
|
|
23
|
+
Try rapid-fuzzy in the browser — no installation required: **[Open Playground](https://derodero24.github.io/rapid-fuzzy/)**
|
|
24
|
+
|
|
23
25
|
## Quick Start
|
|
24
26
|
|
|
25
27
|
```typescript
|
|
@@ -29,7 +31,7 @@ const results = search('typscript', ['TypeScript', 'JavaScript', 'Python']);
|
|
|
29
31
|
// → [{ item: 'TypeScript', score: 0.85, index: 0 }, ...]
|
|
30
32
|
```
|
|
31
33
|
|
|
32
|
-
For repeated searches, use `FuzzyIndex` for up to
|
|
34
|
+
For repeated searches, use `FuzzyIndex` for up to 165x faster lookups:
|
|
33
35
|
|
|
34
36
|
```typescript
|
|
35
37
|
import { FuzzyIndex } from 'rapid-fuzzy';
|
|
@@ -49,9 +51,16 @@ pnpm add rapid-fuzzy
|
|
|
49
51
|
### Runtime-specific notes
|
|
50
52
|
|
|
51
53
|
- **Node.js** (>=20): Uses native bindings via napi-rs for best performance.
|
|
52
|
-
- **Browser / Deno / Bun**: Falls back to a WASM build automatically.
|
|
54
|
+
- **Browser / Deno / Bun**: Falls back to a WASM build automatically. The WASM binary is ~607 KB raw (~200 KB gzipped).
|
|
55
|
+
|
|
56
|
+
> **Browser WASM requirement**: The WASM build uses `SharedArrayBuffer` for threading, which requires the following HTTP headers on your page:
|
|
57
|
+
> ```
|
|
58
|
+
> Cross-Origin-Opener-Policy: same-origin
|
|
59
|
+
> Cross-Origin-Embedder-Policy: require-corp
|
|
60
|
+
> ```
|
|
61
|
+
> Without these headers, you will see `SharedArrayBuffer is not defined`. See [MDN: SharedArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer#security_requirements) for details.
|
|
53
62
|
|
|
54
|
-
|
|
63
|
+
## API
|
|
55
64
|
|
|
56
65
|
### Fuzzy Search
|
|
57
66
|
|
|
@@ -70,9 +79,6 @@ const results = search('typscript', [
|
|
|
70
79
|
// With options: filter by minimum score and limit results
|
|
71
80
|
search('app', items, { maxResults: 5, minScore: 0.3 });
|
|
72
81
|
|
|
73
|
-
// Backward compatible: pass a number for maxResults
|
|
74
|
-
search('app', items, 5);
|
|
75
|
-
|
|
76
82
|
// Get matched character positions for highlighting
|
|
77
83
|
const [match] = search('hlo', ['hello world'], { includePositions: true });
|
|
78
84
|
// → { item: 'hello world', score: 0.75, index: 0, positions: [0, 2, 4] }
|
|
@@ -153,7 +159,7 @@ For applications that search the same dataset repeatedly (autocomplete, file fin
|
|
|
153
159
|
```typescript
|
|
154
160
|
import { FuzzyIndex, FuzzyObjectIndex } from 'rapid-fuzzy';
|
|
155
161
|
|
|
156
|
-
// String search index — up to
|
|
162
|
+
// String search index — up to 165x faster than standalone search()
|
|
157
163
|
const index = new FuzzyIndex(['TypeScript', 'JavaScript', 'Python', ...]);
|
|
158
164
|
|
|
159
165
|
index.search('typscript', { maxResults: 5 });
|
|
@@ -200,7 +206,8 @@ highlightRanges(item, positions);
|
|
|
200
206
|
// → [{ start: 0, end: 1, matched: true }, { start: 1, end: 2, matched: false }, ...]
|
|
201
207
|
```
|
|
202
208
|
|
|
203
|
-
|
|
209
|
+
<details>
|
|
210
|
+
<summary><strong>Token-Based Matching</strong></summary>
|
|
204
211
|
|
|
205
212
|
Order-independent and partial string matching, inspired by Python's [RapidFuzz](https://github.com/rapidfuzz/RapidFuzz):
|
|
206
213
|
|
|
@@ -227,7 +234,10 @@ weightedRatio('John Smith', 'Smith, John'); // 1.0
|
|
|
227
234
|
|
|
228
235
|
All token-based functions include `Batch` and `Many` variants (e.g., `tokenSortRatioBatch`, `tokenSortRatioMany`).
|
|
229
236
|
|
|
230
|
-
|
|
237
|
+
</details>
|
|
238
|
+
|
|
239
|
+
<details>
|
|
240
|
+
<summary><strong>Batch Operations</strong></summary>
|
|
231
241
|
|
|
232
242
|
All distance functions have `Batch` and `Many` variants that amortize FFI overhead:
|
|
233
243
|
|
|
@@ -249,6 +259,8 @@ levenshteinMany('kitten', ['sitting', 'kittens', 'kitchen']);
|
|
|
249
259
|
|
|
250
260
|
> **Tip**: Prefer batch/many variants over calling single-pair functions in a loop — they are significantly faster for multiple comparisons.
|
|
251
261
|
|
|
262
|
+
</details>
|
|
263
|
+
|
|
252
264
|
## Choosing an Algorithm
|
|
253
265
|
|
|
254
266
|
| Use case | Recommended | Why |
|
|
@@ -261,7 +273,7 @@ levenshteinMany('kitten', ['sitting', 'kittens', 'kitchen']);
|
|
|
261
273
|
| Substring / abbreviation matching | `partialRatio` | Finds best partial match within longer strings |
|
|
262
274
|
| Best-effort similarity | `weightedRatio` | Picks the best score across all methods automatically |
|
|
263
275
|
| Interactive fuzzy search | `search`, `closest` | Nucleo algorithm (same as Helix editor) |
|
|
264
|
-
| Repeated search on same data | `FuzzyIndex`, `FuzzyObjectIndex` | Persistent Rust-side index with incremental cache, up to
|
|
276
|
+
| Repeated search on same data | `FuzzyIndex`, `FuzzyObjectIndex` | Persistent Rust-side index with incremental cache, up to 165x faster |
|
|
265
277
|
|
|
266
278
|
**Return types:**
|
|
267
279
|
|
|
@@ -283,11 +295,11 @@ Measured on Apple M-series with Node.js v22 using [Vitest bench](https://vitest.
|
|
|
283
295
|
|
|
284
296
|
| Function | rapid-fuzzy | fastest-levenshtein | leven | string-similarity |
|
|
285
297
|
|---|---:|---:|---:|---:|
|
|
286
|
-
| Levenshtein |
|
|
287
|
-
| Normalized Levenshtein | **
|
|
288
|
-
| Sorensen-Dice | **
|
|
289
|
-
| Jaro-Winkler | **
|
|
290
|
-
| Damerau-Levenshtein | **
|
|
298
|
+
| Levenshtein | 564,605 ops/s | **758,533 ops/s** | 214,205 ops/s | — |
|
|
299
|
+
| Normalized Levenshtein | **515,352 ops/s** | — | — | — |
|
|
300
|
+
| Sorensen-Dice | **152,317 ops/s** | — | — | 86,399 ops/s |
|
|
301
|
+
| Jaro-Winkler | **523,894 ops/s** | — | — | — |
|
|
302
|
+
| Damerau-Levenshtein | **118,113 ops/s** | — | — | — |
|
|
291
303
|
|
|
292
304
|
</details>
|
|
293
305
|
|
|
@@ -304,10 +316,9 @@ Measured on Apple M-series with Node.js v22 using [Vitest bench](https://vitest.
|
|
|
304
316
|
|
|
305
317
|
| Dataset size | rapid-fuzzy | rapid-fuzzy (indexed) | fuse.js | fuzzysort | uFuzzy |
|
|
306
318
|
|---|---:|---:|---:|---:|---:|
|
|
307
|
-
| Small (20 items) |
|
|
308
|
-
| Medium (1K items) | 6,
|
|
309
|
-
| Large (10K items) |
|
|
310
|
-
| XL (50K items) | — | **31,903 ops/s** | — | 5,916 ops/s | 1,292 ops/s |
|
|
319
|
+
| Small (20 items) | 287,682 ops/s | 404,271 ops/s | 126,591 ops/s | **2,655,421 ops/s** | 927,173 ops/s |
|
|
320
|
+
| Medium (1K items) | 6,827 ops/s | **79,616 ops/s** | 366 ops/s | 63,831 ops/s | 30,099 ops/s |
|
|
321
|
+
| Large (10K items) | 827 ops/s | **136,294 ops/s** | 18 ops/s | 27,897 ops/s | 6,461 ops/s |
|
|
311
322
|
|
|
312
323
|
</details>
|
|
313
324
|
|
|
@@ -315,25 +326,16 @@ Measured on Apple M-series with Node.js v22 using [Vitest bench](https://vitest.
|
|
|
315
326
|
|
|
316
327
|
| Dataset size | rapid-fuzzy | rapid-fuzzy (indexed) | fastest-levenshtein |
|
|
317
328
|
|---|---:|---:|---:|
|
|
318
|
-
| Medium (1K items) | 8,
|
|
319
|
-
| Large (10K items) |
|
|
320
|
-
|
|
321
|
-
> In indexed mode (`FuzzyIndex`), rapid-fuzzy is up to **237x faster** than fastest-levenshtein for closest-match lookups.
|
|
329
|
+
| Medium (1K items) | 8,194 ops/s | **978,009 ops/s** | 6,869 ops/s |
|
|
330
|
+
| Large (10K items) | 892 ops/s | **152,196 ops/s** | 679 ops/s |
|
|
322
331
|
|
|
323
|
-
|
|
332
|
+
> In indexed mode (`FuzzyIndex`), rapid-fuzzy is up to **224x faster** than fastest-levenshtein for closest-match lookups.
|
|
324
333
|
|
|
325
|
-
|
|
326
|
-
- **Indexed mode**: `FuzzyIndex` keeps data on the Rust side with an incremental search cache, delivering sub-millisecond autocomplete. On large datasets this is **182x faster** than standalone `search()`.
|
|
327
|
-
- **vs fuzzysort**: `FuzzyIndex` now **outperforms fuzzysort** on medium-and-above datasets — 1.25x faster at 1K, 5.2x at 10K, and 5.4x at 50K.
|
|
328
|
-
- **vs uFuzzy**: `FuzzyIndex` is **2.8x faster** at medium and **21x faster** at large datasets.
|
|
329
|
-
- **vs fastest-levenshtein**: With `FuzzyIndex`, closest-match is **145x faster** at 1K and **237x faster** at 10K.
|
|
334
|
+
### Key takeaways
|
|
330
335
|
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
pnpm run bench # JavaScript benchmarks
|
|
335
|
-
cargo bench # Rust internal benchmarks
|
|
336
|
-
```
|
|
336
|
+
- **vs fuse.js**: `FuzzyIndex` is **218x–7,572x faster** depending on dataset size. Even standalone `search()` is 19–46x faster.
|
|
337
|
+
- **Indexed mode**: `FuzzyIndex` keeps data on the Rust side with incremental caching — **165x faster** than standalone `search()` on large datasets, delivering sub-millisecond autocomplete.
|
|
338
|
+
- **vs fuzzysort / uFuzzy**: `FuzzyIndex` outperforms both on 1K+ datasets (up to 4.9x vs fuzzysort, 21x vs uFuzzy).
|
|
337
339
|
|
|
338
340
|
## Why rapid-fuzzy?
|
|
339
341
|
|
|
@@ -351,7 +353,7 @@ cargo bench # Rust internal benchmarks
|
|
|
351
353
|
| **Highlight utility** | ✅ | — | — | ✅ | ✅ |
|
|
352
354
|
| **Batch API** | ✅ | — | — | — | — |
|
|
353
355
|
| **Node.js native** | ✅ napi-rs | — | — | — | — |
|
|
354
|
-
| **Browser** | ✅ WASM | ✅ | ✅ | ✅ | ✅ |
|
|
356
|
+
| **Browser** | ✅ WASM (~200 KB gzipped) | ✅ | ✅ | ✅ | ✅ |
|
|
355
357
|
| **TypeScript** | ✅ full | ✅ full | ✅ | ✅ | ✅ |
|
|
356
358
|
|
|
357
359
|
## Migration Guides
|
package/index.d.ts
CHANGED
|
@@ -41,6 +41,21 @@ export declare class FuzzyIndex {
|
|
|
41
41
|
remove(index: number): boolean
|
|
42
42
|
/** Free the internal data. After calling this, the index is empty. */
|
|
43
43
|
destroy(): void
|
|
44
|
+
/**
|
|
45
|
+
* Serialize the index to a compact binary format.
|
|
46
|
+
*
|
|
47
|
+
* The returned Buffer can be written to disk, stored in IndexedDB,
|
|
48
|
+
* or transferred over the network. Use `FuzzyIndex.deserialize()` to
|
|
49
|
+
* reconstruct the index.
|
|
50
|
+
*/
|
|
51
|
+
serialize(): Buffer
|
|
52
|
+
/**
|
|
53
|
+
* Reconstruct a FuzzyIndex from a previously serialized Buffer.
|
|
54
|
+
*
|
|
55
|
+
* Pre-computes Utf32String and character masks from the stored items,
|
|
56
|
+
* so the returned index is immediately ready for searching.
|
|
57
|
+
*/
|
|
58
|
+
static deserialize(data: Buffer): FuzzyIndex
|
|
44
59
|
}
|
|
45
60
|
|
|
46
61
|
/**
|
|
@@ -75,12 +90,14 @@ export declare class KeyedFuzzyIndex {
|
|
|
75
90
|
* Add a single item to the index.
|
|
76
91
|
*
|
|
77
92
|
* `key_values` must have the same length as the number of keys.
|
|
93
|
+
* Throws if the length does not match.
|
|
78
94
|
*/
|
|
79
95
|
add(keyValues: Array<string>): void
|
|
80
96
|
/**
|
|
81
97
|
* Add multiple items to the index at once.
|
|
82
98
|
*
|
|
83
99
|
* Each element of `items_key_values` is an array of key values for one item.
|
|
100
|
+
* Throws if any element has the wrong number of key values.
|
|
84
101
|
*/
|
|
85
102
|
addMany(itemsKeyValues: Array<Array<string>>): void
|
|
86
103
|
/**
|
|
@@ -203,6 +220,22 @@ export declare function levenshteinBatch(pairs: Array<Array<string>>): Array<num
|
|
|
203
220
|
*/
|
|
204
221
|
export declare function levenshteinMany(reference: string, candidates: Array<string>): Array<number>
|
|
205
222
|
|
|
223
|
+
/**
|
|
224
|
+
* Classification of how a query matched an item.
|
|
225
|
+
*
|
|
226
|
+
* Derived from the matched character positions:
|
|
227
|
+
* - **Exact**: all positions consecutive from index 0, covering every character in the item.
|
|
228
|
+
* - **Prefix**: all positions consecutive from index 0, but the item is longer.
|
|
229
|
+
* - **Contains**: all positions consecutive (a substring match), not starting at 0.
|
|
230
|
+
* - **Fuzzy**: positions have gaps (character-level fuzzy match).
|
|
231
|
+
*/
|
|
232
|
+
export declare const enum MatchType {
|
|
233
|
+
Exact = 'Exact',
|
|
234
|
+
Prefix = 'Prefix',
|
|
235
|
+
Contains = 'Contains',
|
|
236
|
+
Fuzzy = 'Fuzzy'
|
|
237
|
+
}
|
|
238
|
+
|
|
206
239
|
/**
|
|
207
240
|
* Compute the normalized Levenshtein similarity between two strings.
|
|
208
241
|
*
|
|
@@ -285,6 +318,12 @@ export interface SearchOptions {
|
|
|
285
318
|
* (case-insensitive unless the query contains uppercase characters).
|
|
286
319
|
*/
|
|
287
320
|
isCaseSensitive?: boolean
|
|
321
|
+
/**
|
|
322
|
+
* If true, return all items when the query is empty (or whitespace-only).
|
|
323
|
+
* Useful for filter-as-you-type UIs where the full list should appear
|
|
324
|
+
* before the user starts typing. Default is false.
|
|
325
|
+
*/
|
|
326
|
+
returnAllOnEmpty?: boolean
|
|
288
327
|
}
|
|
289
328
|
|
|
290
329
|
/** A single fuzzy search result with the matched item and its score. */
|
|
@@ -300,6 +339,12 @@ export interface SearchResult {
|
|
|
300
339
|
* Empty unless `includePositions` is set to true in SearchOptions.
|
|
301
340
|
*/
|
|
302
341
|
positions: Array<number>
|
|
342
|
+
/**
|
|
343
|
+
* How the query matched this item (Exact, Prefix, Contains, or Fuzzy).
|
|
344
|
+
* Only present when `includePositions` is set to true in SearchOptions.
|
|
345
|
+
* Derived from positions at zero additional cost.
|
|
346
|
+
*/
|
|
347
|
+
matchType?: MatchType
|
|
303
348
|
}
|
|
304
349
|
|
|
305
350
|
/**
|
package/index.js
CHANGED
|
@@ -77,8 +77,8 @@ function requireNative() {
|
|
|
77
77
|
try {
|
|
78
78
|
const binding = require('rapid-fuzzy-android-arm64')
|
|
79
79
|
const bindingPackageVersion = require('rapid-fuzzy-android-arm64/package.json').version
|
|
80
|
-
if (bindingPackageVersion !== '0.
|
|
81
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
80
|
+
if (bindingPackageVersion !== '1.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
81
|
+
throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
82
82
|
}
|
|
83
83
|
return binding
|
|
84
84
|
} catch (e) {
|
|
@@ -93,8 +93,8 @@ function requireNative() {
|
|
|
93
93
|
try {
|
|
94
94
|
const binding = require('rapid-fuzzy-android-arm-eabi')
|
|
95
95
|
const bindingPackageVersion = require('rapid-fuzzy-android-arm-eabi/package.json').version
|
|
96
|
-
if (bindingPackageVersion !== '0.
|
|
97
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
96
|
+
if (bindingPackageVersion !== '1.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
97
|
+
throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
98
98
|
}
|
|
99
99
|
return binding
|
|
100
100
|
} catch (e) {
|
|
@@ -114,8 +114,8 @@ function requireNative() {
|
|
|
114
114
|
try {
|
|
115
115
|
const binding = require('rapid-fuzzy-win32-x64-gnu')
|
|
116
116
|
const bindingPackageVersion = require('rapid-fuzzy-win32-x64-gnu/package.json').version
|
|
117
|
-
if (bindingPackageVersion !== '0.
|
|
118
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
117
|
+
if (bindingPackageVersion !== '1.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
118
|
+
throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
119
119
|
}
|
|
120
120
|
return binding
|
|
121
121
|
} catch (e) {
|
|
@@ -130,8 +130,8 @@ function requireNative() {
|
|
|
130
130
|
try {
|
|
131
131
|
const binding = require('rapid-fuzzy-win32-x64-msvc')
|
|
132
132
|
const bindingPackageVersion = require('rapid-fuzzy-win32-x64-msvc/package.json').version
|
|
133
|
-
if (bindingPackageVersion !== '0.
|
|
134
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
133
|
+
if (bindingPackageVersion !== '1.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
134
|
+
throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
135
135
|
}
|
|
136
136
|
return binding
|
|
137
137
|
} catch (e) {
|
|
@@ -147,8 +147,8 @@ function requireNative() {
|
|
|
147
147
|
try {
|
|
148
148
|
const binding = require('rapid-fuzzy-win32-ia32-msvc')
|
|
149
149
|
const bindingPackageVersion = require('rapid-fuzzy-win32-ia32-msvc/package.json').version
|
|
150
|
-
if (bindingPackageVersion !== '0.
|
|
151
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
150
|
+
if (bindingPackageVersion !== '1.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
151
|
+
throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
152
152
|
}
|
|
153
153
|
return binding
|
|
154
154
|
} catch (e) {
|
|
@@ -163,8 +163,8 @@ function requireNative() {
|
|
|
163
163
|
try {
|
|
164
164
|
const binding = require('rapid-fuzzy-win32-arm64-msvc')
|
|
165
165
|
const bindingPackageVersion = require('rapid-fuzzy-win32-arm64-msvc/package.json').version
|
|
166
|
-
if (bindingPackageVersion !== '0.
|
|
167
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
166
|
+
if (bindingPackageVersion !== '1.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
167
|
+
throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
168
168
|
}
|
|
169
169
|
return binding
|
|
170
170
|
} catch (e) {
|
|
@@ -182,8 +182,8 @@ function requireNative() {
|
|
|
182
182
|
try {
|
|
183
183
|
const binding = require('rapid-fuzzy-darwin-universal')
|
|
184
184
|
const bindingPackageVersion = require('rapid-fuzzy-darwin-universal/package.json').version
|
|
185
|
-
if (bindingPackageVersion !== '0.
|
|
186
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
185
|
+
if (bindingPackageVersion !== '1.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
186
|
+
throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
187
187
|
}
|
|
188
188
|
return binding
|
|
189
189
|
} catch (e) {
|
|
@@ -198,8 +198,8 @@ function requireNative() {
|
|
|
198
198
|
try {
|
|
199
199
|
const binding = require('rapid-fuzzy-darwin-x64')
|
|
200
200
|
const bindingPackageVersion = require('rapid-fuzzy-darwin-x64/package.json').version
|
|
201
|
-
if (bindingPackageVersion !== '0.
|
|
202
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
201
|
+
if (bindingPackageVersion !== '1.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
202
|
+
throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
203
203
|
}
|
|
204
204
|
return binding
|
|
205
205
|
} catch (e) {
|
|
@@ -214,8 +214,8 @@ function requireNative() {
|
|
|
214
214
|
try {
|
|
215
215
|
const binding = require('rapid-fuzzy-darwin-arm64')
|
|
216
216
|
const bindingPackageVersion = require('rapid-fuzzy-darwin-arm64/package.json').version
|
|
217
|
-
if (bindingPackageVersion !== '0.
|
|
218
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
217
|
+
if (bindingPackageVersion !== '1.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
218
|
+
throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
219
219
|
}
|
|
220
220
|
return binding
|
|
221
221
|
} catch (e) {
|
|
@@ -234,8 +234,8 @@ function requireNative() {
|
|
|
234
234
|
try {
|
|
235
235
|
const binding = require('rapid-fuzzy-freebsd-x64')
|
|
236
236
|
const bindingPackageVersion = require('rapid-fuzzy-freebsd-x64/package.json').version
|
|
237
|
-
if (bindingPackageVersion !== '0.
|
|
238
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
237
|
+
if (bindingPackageVersion !== '1.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
238
|
+
throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
239
239
|
}
|
|
240
240
|
return binding
|
|
241
241
|
} catch (e) {
|
|
@@ -250,8 +250,8 @@ function requireNative() {
|
|
|
250
250
|
try {
|
|
251
251
|
const binding = require('rapid-fuzzy-freebsd-arm64')
|
|
252
252
|
const bindingPackageVersion = require('rapid-fuzzy-freebsd-arm64/package.json').version
|
|
253
|
-
if (bindingPackageVersion !== '0.
|
|
254
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
253
|
+
if (bindingPackageVersion !== '1.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
254
|
+
throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
255
255
|
}
|
|
256
256
|
return binding
|
|
257
257
|
} catch (e) {
|
|
@@ -271,8 +271,8 @@ function requireNative() {
|
|
|
271
271
|
try {
|
|
272
272
|
const binding = require('rapid-fuzzy-linux-x64-musl')
|
|
273
273
|
const bindingPackageVersion = require('rapid-fuzzy-linux-x64-musl/package.json').version
|
|
274
|
-
if (bindingPackageVersion !== '0.
|
|
275
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
274
|
+
if (bindingPackageVersion !== '1.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
275
|
+
throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
276
276
|
}
|
|
277
277
|
return binding
|
|
278
278
|
} catch (e) {
|
|
@@ -287,8 +287,8 @@ function requireNative() {
|
|
|
287
287
|
try {
|
|
288
288
|
const binding = require('rapid-fuzzy-linux-x64-gnu')
|
|
289
289
|
const bindingPackageVersion = require('rapid-fuzzy-linux-x64-gnu/package.json').version
|
|
290
|
-
if (bindingPackageVersion !== '0.
|
|
291
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
290
|
+
if (bindingPackageVersion !== '1.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
291
|
+
throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
292
292
|
}
|
|
293
293
|
return binding
|
|
294
294
|
} catch (e) {
|
|
@@ -305,8 +305,8 @@ function requireNative() {
|
|
|
305
305
|
try {
|
|
306
306
|
const binding = require('rapid-fuzzy-linux-arm64-musl')
|
|
307
307
|
const bindingPackageVersion = require('rapid-fuzzy-linux-arm64-musl/package.json').version
|
|
308
|
-
if (bindingPackageVersion !== '0.
|
|
309
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
308
|
+
if (bindingPackageVersion !== '1.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
309
|
+
throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
310
310
|
}
|
|
311
311
|
return binding
|
|
312
312
|
} catch (e) {
|
|
@@ -321,8 +321,8 @@ function requireNative() {
|
|
|
321
321
|
try {
|
|
322
322
|
const binding = require('rapid-fuzzy-linux-arm64-gnu')
|
|
323
323
|
const bindingPackageVersion = require('rapid-fuzzy-linux-arm64-gnu/package.json').version
|
|
324
|
-
if (bindingPackageVersion !== '0.
|
|
325
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
324
|
+
if (bindingPackageVersion !== '1.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
325
|
+
throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
326
326
|
}
|
|
327
327
|
return binding
|
|
328
328
|
} catch (e) {
|
|
@@ -339,8 +339,8 @@ function requireNative() {
|
|
|
339
339
|
try {
|
|
340
340
|
const binding = require('rapid-fuzzy-linux-arm-musleabihf')
|
|
341
341
|
const bindingPackageVersion = require('rapid-fuzzy-linux-arm-musleabihf/package.json').version
|
|
342
|
-
if (bindingPackageVersion !== '0.
|
|
343
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
342
|
+
if (bindingPackageVersion !== '1.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
343
|
+
throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
344
344
|
}
|
|
345
345
|
return binding
|
|
346
346
|
} catch (e) {
|
|
@@ -355,8 +355,8 @@ function requireNative() {
|
|
|
355
355
|
try {
|
|
356
356
|
const binding = require('rapid-fuzzy-linux-arm-gnueabihf')
|
|
357
357
|
const bindingPackageVersion = require('rapid-fuzzy-linux-arm-gnueabihf/package.json').version
|
|
358
|
-
if (bindingPackageVersion !== '0.
|
|
359
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
358
|
+
if (bindingPackageVersion !== '1.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
359
|
+
throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
360
360
|
}
|
|
361
361
|
return binding
|
|
362
362
|
} catch (e) {
|
|
@@ -373,8 +373,8 @@ function requireNative() {
|
|
|
373
373
|
try {
|
|
374
374
|
const binding = require('rapid-fuzzy-linux-loong64-musl')
|
|
375
375
|
const bindingPackageVersion = require('rapid-fuzzy-linux-loong64-musl/package.json').version
|
|
376
|
-
if (bindingPackageVersion !== '0.
|
|
377
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
376
|
+
if (bindingPackageVersion !== '1.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
377
|
+
throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
378
378
|
}
|
|
379
379
|
return binding
|
|
380
380
|
} catch (e) {
|
|
@@ -389,8 +389,8 @@ function requireNative() {
|
|
|
389
389
|
try {
|
|
390
390
|
const binding = require('rapid-fuzzy-linux-loong64-gnu')
|
|
391
391
|
const bindingPackageVersion = require('rapid-fuzzy-linux-loong64-gnu/package.json').version
|
|
392
|
-
if (bindingPackageVersion !== '0.
|
|
393
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
392
|
+
if (bindingPackageVersion !== '1.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
393
|
+
throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
394
394
|
}
|
|
395
395
|
return binding
|
|
396
396
|
} catch (e) {
|
|
@@ -407,8 +407,8 @@ function requireNative() {
|
|
|
407
407
|
try {
|
|
408
408
|
const binding = require('rapid-fuzzy-linux-riscv64-musl')
|
|
409
409
|
const bindingPackageVersion = require('rapid-fuzzy-linux-riscv64-musl/package.json').version
|
|
410
|
-
if (bindingPackageVersion !== '0.
|
|
411
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
410
|
+
if (bindingPackageVersion !== '1.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
411
|
+
throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
412
412
|
}
|
|
413
413
|
return binding
|
|
414
414
|
} catch (e) {
|
|
@@ -423,8 +423,8 @@ function requireNative() {
|
|
|
423
423
|
try {
|
|
424
424
|
const binding = require('rapid-fuzzy-linux-riscv64-gnu')
|
|
425
425
|
const bindingPackageVersion = require('rapid-fuzzy-linux-riscv64-gnu/package.json').version
|
|
426
|
-
if (bindingPackageVersion !== '0.
|
|
427
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
426
|
+
if (bindingPackageVersion !== '1.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
427
|
+
throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
428
428
|
}
|
|
429
429
|
return binding
|
|
430
430
|
} catch (e) {
|
|
@@ -440,8 +440,8 @@ function requireNative() {
|
|
|
440
440
|
try {
|
|
441
441
|
const binding = require('rapid-fuzzy-linux-ppc64-gnu')
|
|
442
442
|
const bindingPackageVersion = require('rapid-fuzzy-linux-ppc64-gnu/package.json').version
|
|
443
|
-
if (bindingPackageVersion !== '0.
|
|
444
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
443
|
+
if (bindingPackageVersion !== '1.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
444
|
+
throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
445
445
|
}
|
|
446
446
|
return binding
|
|
447
447
|
} catch (e) {
|
|
@@ -456,8 +456,8 @@ function requireNative() {
|
|
|
456
456
|
try {
|
|
457
457
|
const binding = require('rapid-fuzzy-linux-s390x-gnu')
|
|
458
458
|
const bindingPackageVersion = require('rapid-fuzzy-linux-s390x-gnu/package.json').version
|
|
459
|
-
if (bindingPackageVersion !== '0.
|
|
460
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
459
|
+
if (bindingPackageVersion !== '1.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
460
|
+
throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
461
461
|
}
|
|
462
462
|
return binding
|
|
463
463
|
} catch (e) {
|
|
@@ -476,8 +476,8 @@ function requireNative() {
|
|
|
476
476
|
try {
|
|
477
477
|
const binding = require('rapid-fuzzy-openharmony-arm64')
|
|
478
478
|
const bindingPackageVersion = require('rapid-fuzzy-openharmony-arm64/package.json').version
|
|
479
|
-
if (bindingPackageVersion !== '0.
|
|
480
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
479
|
+
if (bindingPackageVersion !== '1.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
480
|
+
throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
481
481
|
}
|
|
482
482
|
return binding
|
|
483
483
|
} catch (e) {
|
|
@@ -492,8 +492,8 @@ function requireNative() {
|
|
|
492
492
|
try {
|
|
493
493
|
const binding = require('rapid-fuzzy-openharmony-x64')
|
|
494
494
|
const bindingPackageVersion = require('rapid-fuzzy-openharmony-x64/package.json').version
|
|
495
|
-
if (bindingPackageVersion !== '0.
|
|
496
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
495
|
+
if (bindingPackageVersion !== '1.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
496
|
+
throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
497
497
|
}
|
|
498
498
|
return binding
|
|
499
499
|
} catch (e) {
|
|
@@ -508,8 +508,8 @@ function requireNative() {
|
|
|
508
508
|
try {
|
|
509
509
|
const binding = require('rapid-fuzzy-openharmony-arm')
|
|
510
510
|
const bindingPackageVersion = require('rapid-fuzzy-openharmony-arm/package.json').version
|
|
511
|
-
if (bindingPackageVersion !== '0.
|
|
512
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
511
|
+
if (bindingPackageVersion !== '1.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
512
|
+
throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
513
513
|
}
|
|
514
514
|
return binding
|
|
515
515
|
} catch (e) {
|
|
@@ -591,6 +591,7 @@ module.exports.jaroWinklerMany = nativeBinding.jaroWinklerMany
|
|
|
591
591
|
module.exports.levenshtein = nativeBinding.levenshtein
|
|
592
592
|
module.exports.levenshteinBatch = nativeBinding.levenshteinBatch
|
|
593
593
|
module.exports.levenshteinMany = nativeBinding.levenshteinMany
|
|
594
|
+
module.exports.MatchType = nativeBinding.MatchType
|
|
594
595
|
module.exports.normalizedLevenshtein = nativeBinding.normalizedLevenshtein
|
|
595
596
|
module.exports.normalizedLevenshteinBatch = nativeBinding.normalizedLevenshteinBatch
|
|
596
597
|
module.exports.normalizedLevenshteinMany = nativeBinding.normalizedLevenshteinMany
|
package/index.mjs
CHANGED
package/objects.d.ts
CHANGED
|
@@ -5,6 +5,10 @@ export interface KeyConfig {
|
|
|
5
5
|
weight?: number;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* Options for searchObjects(). Extends SearchOptions with key configuration.
|
|
10
|
+
* Note: `includePositions` has no effect for multi-key search.
|
|
11
|
+
*/
|
|
8
12
|
export interface ObjectSearchOptions extends SearchOptions {
|
|
9
13
|
keys: Array<string | KeyConfig>;
|
|
10
14
|
}
|
|
@@ -14,11 +18,6 @@ export interface ObjectSearchResult<T> {
|
|
|
14
18
|
index: number;
|
|
15
19
|
score: number;
|
|
16
20
|
keyScores: Array<number>;
|
|
17
|
-
/**
|
|
18
|
-
* Indices of matched characters in the best-matching key string.
|
|
19
|
-
* Empty unless `includePositions` is set to true in ObjectSearchOptions.
|
|
20
|
-
*/
|
|
21
|
-
positions: Array<number>;
|
|
22
21
|
}
|
|
23
22
|
|
|
24
23
|
/**
|
|
@@ -54,6 +53,7 @@ export interface ObjectIndexSearchOptions {
|
|
|
54
53
|
maxResults?: number;
|
|
55
54
|
minScore?: number;
|
|
56
55
|
isCaseSensitive?: boolean;
|
|
56
|
+
returnAllOnEmpty?: boolean;
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
/**
|
|
@@ -85,7 +85,7 @@ export declare class FuzzyObjectIndex<T> {
|
|
|
85
85
|
search(
|
|
86
86
|
query: string,
|
|
87
87
|
options?: ObjectIndexSearchOptions,
|
|
88
|
-
): Array<
|
|
88
|
+
): Array<ObjectSearchResult<T>>;
|
|
89
89
|
|
|
90
90
|
/** Find the closest matching object, or null if no match. */
|
|
91
91
|
closest(query: string, minScore?: number): T | null;
|
package/objects.js
CHANGED
|
@@ -31,9 +31,12 @@ function getNestedValue(obj, path) {
|
|
|
31
31
|
* @param {number} [options.maxResults] - Maximum results to return.
|
|
32
32
|
* @param {number} [options.minScore] - Minimum score threshold.
|
|
33
33
|
* @param {boolean} [options.isCaseSensitive] - Enable case-sensitive matching.
|
|
34
|
-
* @returns {Array<{ item: T; index: number; score: number; keyScores: number[]
|
|
34
|
+
* @returns {Array<{ item: T; index: number; score: number; keyScores: number[] }>}
|
|
35
35
|
*/
|
|
36
36
|
function searchObjects(query, items, options) {
|
|
37
|
+
if (!options?.keys?.length) {
|
|
38
|
+
throw new TypeError('options.keys must be a non-empty array');
|
|
39
|
+
}
|
|
37
40
|
const { keys, ...searchOpts } = options;
|
|
38
41
|
|
|
39
42
|
const normalizedKeys = keys.map((k) =>
|
|
@@ -52,7 +55,6 @@ function searchObjects(query, items, options) {
|
|
|
52
55
|
index: r.index,
|
|
53
56
|
score: r.score,
|
|
54
57
|
keyScores: r.keyScores,
|
|
55
|
-
positions: r.positions ?? [],
|
|
56
58
|
}));
|
|
57
59
|
}
|
|
58
60
|
|
|
@@ -78,6 +80,9 @@ class FuzzyObjectIndex {
|
|
|
78
80
|
* @param {Array<string | { name: string; weight?: number }>} options.keys - Keys to search.
|
|
79
81
|
*/
|
|
80
82
|
constructor(items, options) {
|
|
83
|
+
if (!options?.keys?.length) {
|
|
84
|
+
throw new TypeError('options.keys must be a non-empty array');
|
|
85
|
+
}
|
|
81
86
|
this.#keys = options.keys.map((k) =>
|
|
82
87
|
typeof k === 'string' ? { name: k, weight: 1.0 } : { name: k.name, weight: k.weight ?? 1.0 },
|
|
83
88
|
);
|
package/objects.mjs
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rapid-fuzzy",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "Rust-powered fuzzy search and string distance for JavaScript/TypeScript. 10-50x faster than fuse.js/leven.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "derodero24",
|
|
@@ -12,11 +12,15 @@
|
|
|
12
12
|
"keywords": [
|
|
13
13
|
"fuzzy",
|
|
14
14
|
"fuzzy-search",
|
|
15
|
+
"fuzzy-matching",
|
|
15
16
|
"string-distance",
|
|
17
|
+
"string-similarity",
|
|
16
18
|
"levenshtein",
|
|
17
19
|
"jaro-winkler",
|
|
20
|
+
"hamming",
|
|
21
|
+
"damerau-levenshtein",
|
|
18
22
|
"rust",
|
|
19
|
-
"napi",
|
|
23
|
+
"napi-rs",
|
|
20
24
|
"wasm",
|
|
21
25
|
"typescript",
|
|
22
26
|
"search",
|
|
@@ -39,6 +43,26 @@
|
|
|
39
43
|
"default": "./index.js"
|
|
40
44
|
},
|
|
41
45
|
"browser": "./browser.js"
|
|
46
|
+
},
|
|
47
|
+
"./highlight": {
|
|
48
|
+
"import": {
|
|
49
|
+
"types": "./highlight.d.ts",
|
|
50
|
+
"default": "./highlight.mjs"
|
|
51
|
+
},
|
|
52
|
+
"require": {
|
|
53
|
+
"types": "./highlight.d.ts",
|
|
54
|
+
"default": "./highlight.js"
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"./objects": {
|
|
58
|
+
"import": {
|
|
59
|
+
"types": "./objects.d.ts",
|
|
60
|
+
"default": "./objects.mjs"
|
|
61
|
+
},
|
|
62
|
+
"require": {
|
|
63
|
+
"types": "./objects.d.ts",
|
|
64
|
+
"default": "./objects.js"
|
|
65
|
+
}
|
|
42
66
|
}
|
|
43
67
|
},
|
|
44
68
|
"files": [
|
|
@@ -47,6 +71,7 @@
|
|
|
47
71
|
"index.d.ts",
|
|
48
72
|
"index.d.mts",
|
|
49
73
|
"objects.js",
|
|
74
|
+
"objects.mjs",
|
|
50
75
|
"objects.d.ts",
|
|
51
76
|
"browser.js",
|
|
52
77
|
"highlight.js",
|
|
@@ -132,14 +157,14 @@
|
|
|
132
157
|
]
|
|
133
158
|
},
|
|
134
159
|
"optionalDependencies": {
|
|
135
|
-
"rapid-fuzzy-darwin-x64": "0.
|
|
136
|
-
"rapid-fuzzy-darwin-arm64": "0.
|
|
137
|
-
"rapid-fuzzy-linux-x64-gnu": "0.
|
|
138
|
-
"rapid-fuzzy-linux-x64-musl": "0.
|
|
139
|
-
"rapid-fuzzy-linux-arm64-gnu": "0.
|
|
140
|
-
"rapid-fuzzy-linux-arm64-musl": "0.
|
|
141
|
-
"rapid-fuzzy-win32-x64-msvc": "0.
|
|
142
|
-
"rapid-fuzzy-win32-arm64-msvc": "0.
|
|
143
|
-
"rapid-fuzzy-wasm32-wasi": "0.
|
|
160
|
+
"rapid-fuzzy-darwin-x64": "1.0.0",
|
|
161
|
+
"rapid-fuzzy-darwin-arm64": "1.0.0",
|
|
162
|
+
"rapid-fuzzy-linux-x64-gnu": "1.0.0",
|
|
163
|
+
"rapid-fuzzy-linux-x64-musl": "1.0.0",
|
|
164
|
+
"rapid-fuzzy-linux-arm64-gnu": "1.0.0",
|
|
165
|
+
"rapid-fuzzy-linux-arm64-musl": "1.0.0",
|
|
166
|
+
"rapid-fuzzy-win32-x64-msvc": "1.0.0",
|
|
167
|
+
"rapid-fuzzy-win32-arm64-msvc": "1.0.0",
|
|
168
|
+
"rapid-fuzzy-wasm32-wasi": "1.0.0"
|
|
144
169
|
}
|
|
145
170
|
}
|