rapid-fuzzy 1.0.0 → 1.1.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 -26
- package/index.d.ts +75 -5
- package/index.js +55 -52
- package/index.mjs +3 -0
- package/objects.d.ts +1 -4
- package/package.json +26 -16
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@ Blazing-fast fuzzy search for JavaScript — powered by Rust, works everywhere.
|
|
|
12
12
|
|
|
13
13
|
## Features
|
|
14
14
|
|
|
15
|
-
- **Fast**: Up to
|
|
15
|
+
- **Fast**: Up to 15,000x faster than fuse.js with FuzzyIndex (Rust + napi-rs)
|
|
16
16
|
- **Universal**: Works in Node.js (native), browsers (WASM), Deno, and Bun
|
|
17
17
|
- **Zero JS dependencies**: Pure Rust core with napi-rs bindings
|
|
18
18
|
- **Type-safe**: Full TypeScript support with auto-generated type definitions
|
|
@@ -31,7 +31,7 @@ const results = search('typscript', ['TypeScript', 'JavaScript', 'Python']);
|
|
|
31
31
|
// → [{ item: 'TypeScript', score: 0.85, index: 0 }, ...]
|
|
32
32
|
```
|
|
33
33
|
|
|
34
|
-
For repeated searches, use `FuzzyIndex` for up to
|
|
34
|
+
For repeated searches, use `FuzzyIndex` for up to 297x faster lookups:
|
|
35
35
|
|
|
36
36
|
```typescript
|
|
37
37
|
import { FuzzyIndex } from 'rapid-fuzzy';
|
|
@@ -51,7 +51,7 @@ pnpm add rapid-fuzzy
|
|
|
51
51
|
### Runtime-specific notes
|
|
52
52
|
|
|
53
53
|
- **Node.js** (>=20): Uses native bindings via napi-rs for best performance.
|
|
54
|
-
- **Browser / Deno / Bun**: Falls back to a WASM build automatically. The WASM binary is ~
|
|
54
|
+
- **Browser / Deno / Bun**: Falls back to a WASM build automatically. The WASM binary is ~660 KB raw (~230 KB gzipped).
|
|
55
55
|
|
|
56
56
|
> **Browser WASM requirement**: The WASM build uses `SharedArrayBuffer` for threading, which requires the following HTTP headers on your page:
|
|
57
57
|
> ```
|
|
@@ -86,6 +86,9 @@ const [match] = search('hlo', ['hello world'], { includePositions: true });
|
|
|
86
86
|
// Case-sensitive matching (default: smart case)
|
|
87
87
|
search('Type', items, { isCaseSensitive: true });
|
|
88
88
|
|
|
89
|
+
// Return all items when query is empty (useful for filter-as-you-type UIs)
|
|
90
|
+
search('', items, { returnAllOnEmpty: true });
|
|
91
|
+
|
|
89
92
|
// Find the single best match
|
|
90
93
|
closest('tsc', ['TypeScript', 'JavaScript', 'Python']);
|
|
91
94
|
// → 'TypeScript'
|
|
@@ -98,11 +101,12 @@ closest('xyz', items, 0.5);
|
|
|
98
101
|
### String Distance
|
|
99
102
|
|
|
100
103
|
```typescript
|
|
101
|
-
import { levenshtein, jaroWinkler, sorensenDice } from 'rapid-fuzzy';
|
|
104
|
+
import { levenshtein, jaroWinkler, sorensenDice, hamming } from 'rapid-fuzzy';
|
|
102
105
|
|
|
103
106
|
levenshtein('kitten', 'sitting'); // 3
|
|
104
107
|
jaroWinkler('MARTHA', 'MARHTA'); // 0.961
|
|
105
108
|
sorensenDice('night', 'nacht'); // 0.25
|
|
109
|
+
hamming('karolin', 'kathrin'); // 3 (null if lengths differ)
|
|
106
110
|
```
|
|
107
111
|
|
|
108
112
|
### Query Syntax
|
|
@@ -159,12 +163,16 @@ For applications that search the same dataset repeatedly (autocomplete, file fin
|
|
|
159
163
|
```typescript
|
|
160
164
|
import { FuzzyIndex, FuzzyObjectIndex } from 'rapid-fuzzy';
|
|
161
165
|
|
|
162
|
-
// String search index — up to
|
|
166
|
+
// String search index — up to 297x faster than standalone search()
|
|
163
167
|
const index = new FuzzyIndex(['TypeScript', 'JavaScript', 'Python', ...]);
|
|
164
168
|
|
|
165
169
|
index.search('typscript', { maxResults: 5 });
|
|
166
170
|
index.closest('tsc');
|
|
167
171
|
|
|
172
|
+
// Index-only results (no string cloning — less GC pressure)
|
|
173
|
+
const hits = index.searchIndices('typscript', { maxResults: 5 });
|
|
174
|
+
// → [{ index: 0, score: 0.85, positions: [] }, ...]
|
|
175
|
+
|
|
168
176
|
// Mutate the index without rebuilding
|
|
169
177
|
index.add('Rust');
|
|
170
178
|
index.remove(2); // swap-remove by index
|
|
@@ -255,6 +263,10 @@ levenshteinBatch([
|
|
|
255
263
|
// Compare one string against many candidates
|
|
256
264
|
levenshteinMany('kitten', ['sitting', 'kittens', 'kitchen']);
|
|
257
265
|
// → [3, 1, 2]
|
|
266
|
+
|
|
267
|
+
// With early-termination threshold (skip candidates that can't match)
|
|
268
|
+
levenshteinMany('kitten', candidates, 3); // maxDistance → returns 4 for exceeding
|
|
269
|
+
jaroWinklerMany('MARTHA', candidates, 0.8); // minSimilarity → returns 0.0 for below
|
|
258
270
|
```
|
|
259
271
|
|
|
260
272
|
> **Tip**: Prefer batch/many variants over calling single-pair functions in a loop — they are significantly faster for multiple comparisons.
|
|
@@ -266,6 +278,7 @@ levenshteinMany('kitten', ['sitting', 'kittens', 'kitchen']);
|
|
|
266
278
|
| Use case | Recommended | Why |
|
|
267
279
|
|---|---|---|
|
|
268
280
|
| Typo detection / spell check | `levenshtein`, `damerauLevenshtein` | Counts edits; Damerau adds transposition support |
|
|
281
|
+
| Fixed-length comparison | `hamming` | Counts differing positions; only for equal-length strings |
|
|
269
282
|
| Name / address matching | `jaroWinkler`, `tokenSortRatio` | Prefix-weighted or order-independent matching |
|
|
270
283
|
| Document / text similarity | `sorensenDice` | Bigram-based; handles longer text well |
|
|
271
284
|
| Normalized comparison (0–1) | `normalizedLevenshtein` | Length-independent similarity score |
|
|
@@ -273,11 +286,11 @@ levenshteinMany('kitten', ['sitting', 'kittens', 'kitchen']);
|
|
|
273
286
|
| Substring / abbreviation matching | `partialRatio` | Finds best partial match within longer strings |
|
|
274
287
|
| Best-effort similarity | `weightedRatio` | Picks the best score across all methods automatically |
|
|
275
288
|
| Interactive fuzzy search | `search`, `closest` | Nucleo algorithm (same as Helix editor) |
|
|
276
|
-
| Repeated search on same data | `FuzzyIndex`, `FuzzyObjectIndex` | Persistent Rust-side index with incremental cache, up to
|
|
289
|
+
| Repeated search on same data | `FuzzyIndex`, `FuzzyObjectIndex` | Persistent Rust-side index with incremental cache, up to 297x faster |
|
|
277
290
|
|
|
278
291
|
**Return types:**
|
|
279
292
|
|
|
280
|
-
- `levenshtein`, `damerauLevenshtein` → integer (edit count)
|
|
293
|
+
- `levenshtein`, `damerauLevenshtein`, `hamming` → integer (edit/difference count; `hamming` returns `null` if lengths differ)
|
|
281
294
|
- `jaro`, `jaroWinkler`, `sorensenDice`, `normalizedLevenshtein` → float between 0.0 (no match) and 1.0 (identical)
|
|
282
295
|
- `tokenSortRatio`, `tokenSetRatio`, `partialRatio`, `weightedRatio` → float between 0.0 and 1.0
|
|
283
296
|
- `search` → array of `{ item, score, index, positions }` sorted by relevance (score: 0.0–1.0)
|
|
@@ -295,15 +308,16 @@ Measured on Apple M-series with Node.js v22 using [Vitest bench](https://vitest.
|
|
|
295
308
|
|
|
296
309
|
| Function | rapid-fuzzy | fastest-levenshtein | leven | string-similarity |
|
|
297
310
|
|---|---:|---:|---:|---:|
|
|
298
|
-
| Levenshtein |
|
|
299
|
-
| Normalized Levenshtein | **
|
|
300
|
-
| Sorensen-Dice | **
|
|
301
|
-
| Jaro-Winkler | **
|
|
302
|
-
| Damerau-Levenshtein | **
|
|
311
|
+
| Levenshtein | 545,338 ops/s | **741,195 ops/s** | 225,457 ops/s | — |
|
|
312
|
+
| Normalized Levenshtein | **514,446 ops/s** | — | — | — |
|
|
313
|
+
| Sorensen-Dice | **142,180 ops/s** | — | — | 56,729 ops/s |
|
|
314
|
+
| Jaro-Winkler | **505,762 ops/s** | — | — | — |
|
|
315
|
+
| Damerau-Levenshtein | **116,186 ops/s** | — | — | — |
|
|
316
|
+
| Hamming | **883,614 ops/s** | — | — | — |
|
|
303
317
|
|
|
304
318
|
</details>
|
|
305
319
|
|
|
306
|
-
> **Note**: For single-pair Levenshtein, fastest-levenshtein is ~1.4x faster due to its optimized pure-JS implementation that avoids FFI overhead. rapid-fuzzy is **2.
|
|
320
|
+
> **Note**: For single-pair Levenshtein, fastest-levenshtein is ~1.4x faster due to its optimized pure-JS implementation that avoids FFI overhead. rapid-fuzzy is **2.4x faster** than leven, and provides broader algorithm coverage plus batch / search scenarios.
|
|
307
321
|
|
|
308
322
|
### Search Performance
|
|
309
323
|
|
|
@@ -316,9 +330,9 @@ Measured on Apple M-series with Node.js v22 using [Vitest bench](https://vitest.
|
|
|
316
330
|
|
|
317
331
|
| Dataset size | rapid-fuzzy | rapid-fuzzy (indexed) | fuse.js | fuzzysort | uFuzzy |
|
|
318
332
|
|---|---:|---:|---:|---:|---:|
|
|
319
|
-
| Small (20 items) |
|
|
320
|
-
| Medium (1K items) | 6,
|
|
321
|
-
| Large (10K items) |
|
|
333
|
+
| Small (20 items) | 279,509 ops/s | 395,932 ops/s | 118,443 ops/s | **1,661,273 ops/s** | 422,032 ops/s |
|
|
334
|
+
| Medium (1K items) | 6,274 ops/s | **77,271 ops/s** | 358 ops/s | 58,123 ops/s | 26,052 ops/s |
|
|
335
|
+
| Large (10K items) | 777 ops/s | **230,848 ops/s** | 15 ops/s | 25,315 ops/s | 4,663 ops/s |
|
|
322
336
|
|
|
323
337
|
</details>
|
|
324
338
|
|
|
@@ -326,22 +340,22 @@ Measured on Apple M-series with Node.js v22 using [Vitest bench](https://vitest.
|
|
|
326
340
|
|
|
327
341
|
| Dataset size | rapid-fuzzy | rapid-fuzzy (indexed) | fastest-levenshtein |
|
|
328
342
|
|---|---:|---:|---:|
|
|
329
|
-
| Medium (1K items) |
|
|
330
|
-
| Large (10K items) |
|
|
343
|
+
| Medium (1K items) | 7,690 ops/s | **906,274 ops/s** | 3,536 ops/s |
|
|
344
|
+
| Large (10K items) | 611 ops/s | **352,688 ops/s** | 620 ops/s |
|
|
331
345
|
|
|
332
|
-
> In indexed mode (`FuzzyIndex`), rapid-fuzzy is up to **
|
|
346
|
+
> In indexed mode (`FuzzyIndex`), rapid-fuzzy is up to **569x faster** than fastest-levenshtein for closest-match lookups.
|
|
333
347
|
|
|
334
348
|
### Key takeaways
|
|
335
349
|
|
|
336
|
-
- **vs fuse.js**: `FuzzyIndex` is **
|
|
337
|
-
- **Indexed mode**: `FuzzyIndex` keeps data on the Rust side with incremental caching — **
|
|
338
|
-
- **vs fuzzysort / uFuzzy**: `FuzzyIndex` outperforms both on 1K+ datasets (up to
|
|
350
|
+
- **vs fuse.js**: `FuzzyIndex` is **216x–15,390x faster** depending on dataset size. Even standalone `search()` is 18–52x faster.
|
|
351
|
+
- **Indexed mode**: `FuzzyIndex` keeps data on the Rust side with incremental caching — **297x faster** than standalone `search()` on large datasets, delivering sub-millisecond autocomplete.
|
|
352
|
+
- **vs fuzzysort / uFuzzy**: `FuzzyIndex` outperforms both on 1K+ datasets (up to 9.1x vs fuzzysort, 50x vs uFuzzy).
|
|
339
353
|
|
|
340
354
|
## Why rapid-fuzzy?
|
|
341
355
|
|
|
342
356
|
| | rapid-fuzzy | fuse.js | fastest-levenshtein | fuzzysort | uFuzzy |
|
|
343
357
|
|---|:---:|:---:|:---:|:---:|:---:|
|
|
344
|
-
| **Algorithms** |
|
|
358
|
+
| **Algorithms** | 10 (Levenshtein, Hamming, Jaro, Dice, …) | Bitap | Levenshtein | Substring | Regex-based |
|
|
345
359
|
| **Runtime** | Rust native + WASM | Pure JS | Pure JS | Pure JS | Pure JS |
|
|
346
360
|
| **Object search** | ✅ weighted keys | ✅ | — | ✅ | — |
|
|
347
361
|
| **Persistent index** | ✅ FuzzyIndex / FuzzyObjectIndex | — | — | ✅ prepared targets | — |
|
|
@@ -353,7 +367,7 @@ Measured on Apple M-series with Node.js v22 using [Vitest bench](https://vitest.
|
|
|
353
367
|
| **Highlight utility** | ✅ | — | — | ✅ | ✅ |
|
|
354
368
|
| **Batch API** | ✅ | — | — | — | — |
|
|
355
369
|
| **Node.js native** | ✅ napi-rs | — | — | — | — |
|
|
356
|
-
| **Browser** | ✅ WASM (~
|
|
370
|
+
| **Browser** | ✅ WASM (~230 KB gzipped) | ✅ | ✅ | ✅ | ✅ |
|
|
357
371
|
| **TypeScript** | ✅ full | ✅ full | ✅ | ✅ | ✅ |
|
|
358
372
|
|
|
359
373
|
## Migration Guides
|
|
@@ -361,9 +375,9 @@ Measured on Apple M-series with Node.js v22 using [Vitest bench](https://vitest.
|
|
|
361
375
|
Switching from another library? These guides provide API mapping tables, code examples, and performance comparisons:
|
|
362
376
|
|
|
363
377
|
- [**From string-similarity**](docs/migration/from-string-similarity.md) — Same Dice coefficient algorithm, now maintained and faster
|
|
364
|
-
- [**From fuse.js**](docs/migration/from-fuse-js.md) — Up to
|
|
378
|
+
- [**From fuse.js**](docs/migration/from-fuse-js.md) — Up to 15,000x faster fuzzy search with FuzzyIndex
|
|
365
379
|
- [**From leven / fastest-levenshtein**](docs/migration/from-leven.md) — Multi-algorithm upgrade with batch APIs
|
|
366
|
-
- [**From fuzzysort**](docs/migration/from-fuzzysort.md) — Richer matching with query syntax and
|
|
380
|
+
- [**From fuzzysort**](docs/migration/from-fuzzysort.md) — Richer matching with query syntax and 10 distance algorithms
|
|
367
381
|
- [**From uFuzzy**](docs/migration/from-ufuzzy.md) — Weighted object search, batch APIs, and persistent indexes
|
|
368
382
|
|
|
369
383
|
## License
|
package/index.d.ts
CHANGED
|
@@ -29,6 +29,14 @@ export declare class FuzzyIndex {
|
|
|
29
29
|
* If minScore is provided, returns null when the best match scores below the threshold.
|
|
30
30
|
*/
|
|
31
31
|
closest(query: string, minScore?: number | undefined | null): string | null
|
|
32
|
+
/**
|
|
33
|
+
* Search the index, returning only indices and scores (no item strings).
|
|
34
|
+
*
|
|
35
|
+
* This is more efficient than `search()` when you maintain your own data
|
|
36
|
+
* array and only need the index to look up the original item. Avoids
|
|
37
|
+
* String cloning overhead for each result.
|
|
38
|
+
*/
|
|
39
|
+
searchIndices(query: string, options?: number | SearchOptions | undefined | null): Array<IndexSearchResult>
|
|
32
40
|
/** Add a single item to the index. */
|
|
33
41
|
add(item: string): void
|
|
34
42
|
/** Add multiple items to the index at once. */
|
|
@@ -137,8 +145,62 @@ export declare function damerauLevenshteinBatch(pairs: Array<Array<string>>): Ar
|
|
|
137
145
|
* Compute the Damerau-Levenshtein distance from one reference string to many candidates.
|
|
138
146
|
*
|
|
139
147
|
* Returns an array of distances, one per candidate, in the same order as the input.
|
|
148
|
+
* If `max_distance` is provided, candidates with distance exceeding the threshold
|
|
149
|
+
* will return `max_distance + 1` (enabling early termination for better performance).
|
|
150
|
+
*/
|
|
151
|
+
export declare function damerauLevenshteinMany(reference: string, candidates: Array<string>, maxDistance?: number | undefined | null): Array<number>
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Compute the Hamming distance between two strings.
|
|
155
|
+
*
|
|
156
|
+
* The Hamming distance counts the number of positions at which the corresponding
|
|
157
|
+
* characters differ. It is only defined for strings of equal length.
|
|
158
|
+
* Returns `null` if the strings have different lengths.
|
|
159
|
+
*/
|
|
160
|
+
export declare function hamming(a: string, b: string): number | null
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Compute the Hamming distance for multiple pairs of strings in a single call.
|
|
164
|
+
*
|
|
165
|
+
* Returns an array of distances in the same order as the input pairs.
|
|
166
|
+
* Each pair must be an array of exactly two strings `[a, b]`.
|
|
167
|
+
* Returns `null` for pairs with different lengths.
|
|
168
|
+
*/
|
|
169
|
+
export declare function hammingBatch(pairs: Array<Array<string>>): Array<number | undefined | null>
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Compute the Hamming distance from one reference string to many candidates.
|
|
173
|
+
*
|
|
174
|
+
* Returns an array of distances, one per candidate, in the same order as the input.
|
|
175
|
+
* Returns `null` for candidates with a different length than the reference.
|
|
176
|
+
* If `max_distance` is provided, candidates with distance exceeding the threshold
|
|
177
|
+
* will also return `null` (enabling early termination for better performance).
|
|
178
|
+
*/
|
|
179
|
+
export declare function hammingMany(reference: string, candidates: Array<string>, maxDistance?: number | undefined | null): Array<number | undefined | null>
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* A lightweight search result containing only index and score (no item string).
|
|
183
|
+
*
|
|
184
|
+
* Use this when you maintain your own data array and only need the index
|
|
185
|
+
* to look up the original item. Avoids String cloning overhead.
|
|
140
186
|
*/
|
|
141
|
-
export
|
|
187
|
+
export interface IndexSearchResult {
|
|
188
|
+
/** The index of the item in the original input array. */
|
|
189
|
+
index: number
|
|
190
|
+
/** The match score normalized to 0.0-1.0 range (1.0 is a perfect match). */
|
|
191
|
+
score: number
|
|
192
|
+
/**
|
|
193
|
+
* Indices of matched characters in the item string.
|
|
194
|
+
* Empty unless `includePositions` is set to true in SearchOptions.
|
|
195
|
+
*/
|
|
196
|
+
positions: Array<number>
|
|
197
|
+
/**
|
|
198
|
+
* How the query matched this item (Exact, Prefix, Contains, or Fuzzy).
|
|
199
|
+
* Only present when `includePositions` is set to true in SearchOptions.
|
|
200
|
+
* Derived from positions at zero additional cost.
|
|
201
|
+
*/
|
|
202
|
+
matchType?: MatchType
|
|
203
|
+
}
|
|
142
204
|
|
|
143
205
|
/**
|
|
144
206
|
* Compute the Jaro similarity between two strings.
|
|
@@ -158,8 +220,10 @@ export declare function jaroBatch(pairs: Array<Array<string>>): Array<number>
|
|
|
158
220
|
* Compute the Jaro similarity from one reference string to many candidates.
|
|
159
221
|
*
|
|
160
222
|
* Returns an array of similarity scores, one per candidate, in the same order as the input.
|
|
223
|
+
* If `min_similarity` is provided, candidates with similarity below the threshold
|
|
224
|
+
* will return `0.0` (enabling early termination for better performance).
|
|
161
225
|
*/
|
|
162
|
-
export declare function jaroMany(reference: string, candidates: Array<string
|
|
226
|
+
export declare function jaroMany(reference: string, candidates: Array<string>, minSimilarity?: number | undefined | null): Array<number>
|
|
163
227
|
|
|
164
228
|
/**
|
|
165
229
|
* Compute the Jaro-Winkler similarity between two strings.
|
|
@@ -180,8 +244,10 @@ export declare function jaroWinklerBatch(pairs: Array<Array<string>>): Array<num
|
|
|
180
244
|
* Compute the Jaro-Winkler similarity from one reference string to many candidates.
|
|
181
245
|
*
|
|
182
246
|
* Returns an array of similarity scores, one per candidate, in the same order as the input.
|
|
247
|
+
* If `min_similarity` is provided, candidates with similarity below the threshold
|
|
248
|
+
* will return `0.0` (enabling early termination for better performance).
|
|
183
249
|
*/
|
|
184
|
-
export declare function jaroWinklerMany(reference: string, candidates: Array<string
|
|
250
|
+
export declare function jaroWinklerMany(reference: string, candidates: Array<string>, minSimilarity?: number | undefined | null): Array<number>
|
|
185
251
|
|
|
186
252
|
/** A single result from multi-key fuzzy search. */
|
|
187
253
|
export interface KeySearchResult {
|
|
@@ -217,8 +283,10 @@ export declare function levenshteinBatch(pairs: Array<Array<string>>): Array<num
|
|
|
217
283
|
* Compute the Levenshtein distance from one reference string to many candidates.
|
|
218
284
|
*
|
|
219
285
|
* Returns an array of distances, one per candidate, in the same order as the input.
|
|
286
|
+
* If `max_distance` is provided, candidates with distance exceeding the threshold
|
|
287
|
+
* will return `max_distance + 1` (enabling early termination for better performance).
|
|
220
288
|
*/
|
|
221
|
-
export declare function levenshteinMany(reference: string, candidates: Array<string
|
|
289
|
+
export declare function levenshteinMany(reference: string, candidates: Array<string>, maxDistance?: number | undefined | null): Array<number>
|
|
222
290
|
|
|
223
291
|
/**
|
|
224
292
|
* Classification of how a query matched an item.
|
|
@@ -254,8 +322,10 @@ export declare function normalizedLevenshteinBatch(pairs: Array<Array<string>>):
|
|
|
254
322
|
* Compute the normalized Levenshtein similarity from one reference string to many candidates.
|
|
255
323
|
*
|
|
256
324
|
* Returns an array of similarity scores, one per candidate, in the same order as the input.
|
|
325
|
+
* If `min_similarity` is provided, candidates with similarity below the threshold
|
|
326
|
+
* will return `0.0` (enabling early termination for better performance).
|
|
257
327
|
*/
|
|
258
|
-
export declare function normalizedLevenshteinMany(reference: string, candidates: Array<string
|
|
328
|
+
export declare function normalizedLevenshteinMany(reference: string, candidates: Array<string>, minSimilarity?: number | undefined | null): Array<number>
|
|
259
329
|
|
|
260
330
|
/**
|
|
261
331
|
* Compute the partial ratio between two strings.
|
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 !== '1.
|
|
81
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
80
|
+
if (bindingPackageVersion !== '1.1.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.1.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 !== '1.
|
|
97
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
96
|
+
if (bindingPackageVersion !== '1.1.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.1.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 !== '1.
|
|
118
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
117
|
+
if (bindingPackageVersion !== '1.1.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.1.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 !== '1.
|
|
134
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
133
|
+
if (bindingPackageVersion !== '1.1.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.1.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 !== '1.
|
|
151
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
150
|
+
if (bindingPackageVersion !== '1.1.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.1.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 !== '1.
|
|
167
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
166
|
+
if (bindingPackageVersion !== '1.1.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.1.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 !== '1.
|
|
186
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
185
|
+
if (bindingPackageVersion !== '1.1.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.1.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 !== '1.
|
|
202
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
201
|
+
if (bindingPackageVersion !== '1.1.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.1.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 !== '1.
|
|
218
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
217
|
+
if (bindingPackageVersion !== '1.1.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.1.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 !== '1.
|
|
238
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
237
|
+
if (bindingPackageVersion !== '1.1.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.1.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 !== '1.
|
|
254
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
253
|
+
if (bindingPackageVersion !== '1.1.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.1.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 !== '1.
|
|
275
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
274
|
+
if (bindingPackageVersion !== '1.1.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.1.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 !== '1.
|
|
291
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
290
|
+
if (bindingPackageVersion !== '1.1.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.1.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 !== '1.
|
|
309
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
308
|
+
if (bindingPackageVersion !== '1.1.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.1.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 !== '1.
|
|
325
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
324
|
+
if (bindingPackageVersion !== '1.1.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.1.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 !== '1.
|
|
343
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
342
|
+
if (bindingPackageVersion !== '1.1.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.1.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 !== '1.
|
|
359
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
358
|
+
if (bindingPackageVersion !== '1.1.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.1.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 !== '1.
|
|
377
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
376
|
+
if (bindingPackageVersion !== '1.1.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.1.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 !== '1.
|
|
393
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
392
|
+
if (bindingPackageVersion !== '1.1.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.1.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 !== '1.
|
|
411
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
410
|
+
if (bindingPackageVersion !== '1.1.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.1.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 !== '1.
|
|
427
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
426
|
+
if (bindingPackageVersion !== '1.1.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.1.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 !== '1.
|
|
444
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
443
|
+
if (bindingPackageVersion !== '1.1.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.1.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 !== '1.
|
|
460
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
459
|
+
if (bindingPackageVersion !== '1.1.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.1.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 !== '1.
|
|
480
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
479
|
+
if (bindingPackageVersion !== '1.1.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.1.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 !== '1.
|
|
496
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
495
|
+
if (bindingPackageVersion !== '1.1.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.1.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 !== '1.
|
|
512
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
511
|
+
if (bindingPackageVersion !== '1.1.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.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
513
513
|
}
|
|
514
514
|
return binding
|
|
515
515
|
} catch (e) {
|
|
@@ -582,6 +582,9 @@ module.exports.closest = nativeBinding.closest
|
|
|
582
582
|
module.exports.damerauLevenshtein = nativeBinding.damerauLevenshtein
|
|
583
583
|
module.exports.damerauLevenshteinBatch = nativeBinding.damerauLevenshteinBatch
|
|
584
584
|
module.exports.damerauLevenshteinMany = nativeBinding.damerauLevenshteinMany
|
|
585
|
+
module.exports.hamming = nativeBinding.hamming
|
|
586
|
+
module.exports.hammingBatch = nativeBinding.hammingBatch
|
|
587
|
+
module.exports.hammingMany = nativeBinding.hammingMany
|
|
585
588
|
module.exports.jaro = nativeBinding.jaro
|
|
586
589
|
module.exports.jaroBatch = nativeBinding.jaroBatch
|
|
587
590
|
module.exports.jaroMany = nativeBinding.jaroMany
|
package/index.mjs
CHANGED
package/objects.d.ts
CHANGED
|
@@ -82,10 +82,7 @@ export declare class FuzzyObjectIndex<T> {
|
|
|
82
82
|
get size(): number;
|
|
83
83
|
|
|
84
84
|
/** Search for objects matching the query. */
|
|
85
|
-
search(
|
|
86
|
-
query: string,
|
|
87
|
-
options?: ObjectIndexSearchOptions,
|
|
88
|
-
): Array<ObjectSearchResult<T>>;
|
|
85
|
+
search(query: string, options?: ObjectIndexSearchOptions): Array<ObjectSearchResult<T>>;
|
|
89
86
|
|
|
90
87
|
/** Find the closest matching object, or null if no match. */
|
|
91
88
|
closest(query: string, minScore?: number): T | null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rapid-fuzzy",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.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",
|
|
@@ -101,6 +101,8 @@
|
|
|
101
101
|
"postbuild": "node scripts/patch-binding.js",
|
|
102
102
|
"build:debug": "napi build --manifest-path crates/core/Cargo.toml --platform --js index.js --dts index.d.ts --output-dir .",
|
|
103
103
|
"build:wasm": "napi build --manifest-path crates/core/Cargo.toml --platform --release --js index.js --dts index.d.ts --output-dir . --target wasm32-wasip1-threads",
|
|
104
|
+
"postbuild:wasm": "node scripts/optimize-wasm.js",
|
|
105
|
+
"optimize:wasm": "node scripts/optimize-wasm.js",
|
|
104
106
|
"artifacts": "napi artifacts",
|
|
105
107
|
"prepublishOnly": "napi prepublish -t npm",
|
|
106
108
|
"version": "napi version",
|
|
@@ -125,13 +127,13 @@
|
|
|
125
127
|
"prepare": "lefthook install"
|
|
126
128
|
},
|
|
127
129
|
"devDependencies": {
|
|
128
|
-
"@biomejs/biome": "^2.4.
|
|
130
|
+
"@biomejs/biome": "^2.4.8",
|
|
129
131
|
"@changesets/cli": "^2.30.0",
|
|
130
132
|
"@codspeed/vitest-plugin": "^5.2.0",
|
|
131
|
-
"@commitlint/cli": "^20.
|
|
132
|
-
"@commitlint/config-conventional": "^20.
|
|
133
|
-
"@emnapi/core": "^1.9.
|
|
134
|
-
"@emnapi/runtime": "^1.9.
|
|
133
|
+
"@commitlint/cli": "^20.5.0",
|
|
134
|
+
"@commitlint/config-conventional": "^20.5.0",
|
|
135
|
+
"@emnapi/core": "^1.9.1",
|
|
136
|
+
"@emnapi/runtime": "^1.9.1",
|
|
135
137
|
"@leeoniya/ufuzzy": "^1.0.19",
|
|
136
138
|
"@napi-rs/cli": "^3.5.1",
|
|
137
139
|
"@napi-rs/wasm-runtime": "^1.1.1",
|
|
@@ -141,10 +143,13 @@
|
|
|
141
143
|
"@types/string-similarity": "^4.0.2",
|
|
142
144
|
"@vitest/coverage-v8": "^4.1.0",
|
|
143
145
|
"fastest-levenshtein": "^1.0.16",
|
|
146
|
+
"flexsearch": "^0.8.212",
|
|
144
147
|
"fuse.js": "^7.1.0",
|
|
148
|
+
"fuzzball": "^2.2.3",
|
|
145
149
|
"fuzzysort": "^3.1.0",
|
|
146
150
|
"lefthook": "^2.1.4",
|
|
147
151
|
"leven": "^4.1.0",
|
|
152
|
+
"minisearch": "^7.2.0",
|
|
148
153
|
"publint": "^0.3.18",
|
|
149
154
|
"string-similarity": "^4.0.4",
|
|
150
155
|
"typescript": "^5.9.3",
|
|
@@ -154,17 +159,22 @@
|
|
|
154
159
|
"pnpm": {
|
|
155
160
|
"onlyBuiltDependencies": [
|
|
156
161
|
"lefthook"
|
|
157
|
-
]
|
|
162
|
+
],
|
|
163
|
+
"peerDependencyRules": {
|
|
164
|
+
"allowedVersions": {
|
|
165
|
+
"@codspeed/vitest-plugin>vite": "8"
|
|
166
|
+
}
|
|
167
|
+
}
|
|
158
168
|
},
|
|
159
169
|
"optionalDependencies": {
|
|
160
|
-
"rapid-fuzzy-darwin-x64": "1.
|
|
161
|
-
"rapid-fuzzy-darwin-arm64": "1.
|
|
162
|
-
"rapid-fuzzy-linux-x64-gnu": "1.
|
|
163
|
-
"rapid-fuzzy-linux-x64-musl": "1.
|
|
164
|
-
"rapid-fuzzy-linux-arm64-gnu": "1.
|
|
165
|
-
"rapid-fuzzy-linux-arm64-musl": "1.
|
|
166
|
-
"rapid-fuzzy-win32-x64-msvc": "1.
|
|
167
|
-
"rapid-fuzzy-win32-arm64-msvc": "1.
|
|
168
|
-
"rapid-fuzzy-wasm32-wasi": "1.
|
|
170
|
+
"rapid-fuzzy-darwin-x64": "1.1.0",
|
|
171
|
+
"rapid-fuzzy-darwin-arm64": "1.1.0",
|
|
172
|
+
"rapid-fuzzy-linux-x64-gnu": "1.1.0",
|
|
173
|
+
"rapid-fuzzy-linux-x64-musl": "1.1.0",
|
|
174
|
+
"rapid-fuzzy-linux-arm64-gnu": "1.1.0",
|
|
175
|
+
"rapid-fuzzy-linux-arm64-musl": "1.1.0",
|
|
176
|
+
"rapid-fuzzy-win32-x64-msvc": "1.1.0",
|
|
177
|
+
"rapid-fuzzy-win32-arm64-msvc": "1.1.0",
|
|
178
|
+
"rapid-fuzzy-wasm32-wasi": "1.1.0"
|
|
169
179
|
}
|
|
170
180
|
}
|