rapid-fuzzy 1.2.0 → 2.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 +69 -5
- package/highlight.d.mts +1 -1
- package/index.d.mts +5 -5
- package/index.js +52 -52
- package/objects.d.mts +3 -3
- package/package.json +22 -16
- package/rapid-fuzzy-wasm-bindgen.js +1 -1
- package/rapid-fuzzy-wasm-bindgen_bg.js +48 -51
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
[](https://www.npmjs.com/package/rapid-fuzzy)
|
|
7
7
|
[](https://www.npmjs.com/package/rapid-fuzzy)
|
|
8
8
|
[](https://opensource.org/licenses/MIT)
|
|
9
|
-
[](https://nodejs.org/)
|
|
10
10
|
|
|
11
11
|
Blazing-fast fuzzy search for JavaScript — powered by Rust, works everywhere.
|
|
12
12
|
|
|
@@ -28,7 +28,7 @@ Try rapid-fuzzy in the browser — no installation required: **[Open Playground]
|
|
|
28
28
|
import { search } from 'rapid-fuzzy';
|
|
29
29
|
|
|
30
30
|
const results = search('typscript', ['TypeScript', 'JavaScript', 'Python']);
|
|
31
|
-
// → [{ item: 'TypeScript', score: 0.85, index: 0 }, ...]
|
|
31
|
+
// → [{ item: 'TypeScript', score: 0.85, index: 0, positions: [] }, ...]
|
|
32
32
|
```
|
|
33
33
|
|
|
34
34
|
For repeated searches, use `FuzzyIndex` for up to 297x faster lookups:
|
|
@@ -50,7 +50,7 @@ pnpm add rapid-fuzzy
|
|
|
50
50
|
|
|
51
51
|
### Runtime-specific notes
|
|
52
52
|
|
|
53
|
-
- **Node.js** (>=
|
|
53
|
+
- **Node.js** (>=22): Uses native bindings via napi-rs for best performance.
|
|
54
54
|
- **Bun**: Uses native napi-rs bindings. WASM fallback also works — see [Bun section](#bun) below.
|
|
55
55
|
- **Browser / CDN / Cloudflare Workers / Deno**: Falls back to the wasm-bindgen WASM build (~195 KB raw). No `SharedArrayBuffer` or COOP/COEP headers required.
|
|
56
56
|
|
|
@@ -154,7 +154,27 @@ import { search } from 'https://esm.sh/rapid-fuzzy';
|
|
|
154
154
|
|
|
155
155
|
#### Bun
|
|
156
156
|
|
|
157
|
-
Bun uses the native napi-rs bindings when available (fastest). You can also use the wasm-bindgen WASM files directly if needed
|
|
157
|
+
Bun uses the native napi-rs bindings when available (fastest). You can also use the wasm-bindgen WASM files directly if needed:
|
|
158
|
+
|
|
159
|
+
```typescript
|
|
160
|
+
import * as wasm from 'rapid-fuzzy/rapid-fuzzy-wasm-bindgen_bg.js';
|
|
161
|
+
import { readFileSync } from 'node:fs';
|
|
162
|
+
|
|
163
|
+
const wasmPath = require.resolve('rapid-fuzzy/rapid-fuzzy-wasm-bindgen_bg.wasm');
|
|
164
|
+
const wasmModule = new WebAssembly.Module(readFileSync(wasmPath));
|
|
165
|
+
const wasmInstance = new WebAssembly.Instance(wasmModule, {
|
|
166
|
+
'./rapid-fuzzy-wasm-bindgen_bg.js': wasm,
|
|
167
|
+
});
|
|
168
|
+
wasm.__wbg_set_wasm(wasmInstance.exports);
|
|
169
|
+
|
|
170
|
+
// Now use the WASM API directly
|
|
171
|
+
const results = wasm.search('typscript', ['TypeScript', 'JavaScript', 'Python']);
|
|
172
|
+
const index = new wasm.FuzzyIndex(['apple', 'banana', 'cherry']);
|
|
173
|
+
index.search('aple');
|
|
174
|
+
index.destroy();
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
See [`e2e/wasm-bun.test.ts`](e2e/wasm-bun.test.ts) for a complete working example.
|
|
158
178
|
|
|
159
179
|
## API
|
|
160
180
|
|
|
@@ -267,7 +287,9 @@ searchObjects('new york', items, { keys: ['address.city'] });
|
|
|
267
287
|
|
|
268
288
|
### Persistent Index
|
|
269
289
|
|
|
270
|
-
For applications that search the same dataset repeatedly (autocomplete, file finders, etc.), use `FuzzyIndex` or `FuzzyObjectIndex` to keep data on the Rust side and eliminate per-search FFI overhead
|
|
290
|
+
For applications that search the same dataset repeatedly (autocomplete, file finders, etc.), use `FuzzyIndex` or `FuzzyObjectIndex` to keep data on the Rust side and eliminate per-search FFI overhead.
|
|
291
|
+
|
|
292
|
+
**When to use which:** The standalone `search()` function requires zero setup and is ideal for one-off queries or small datasets. `FuzzyIndex` has an initial build cost but delivers sub-millisecond repeated queries, making it the better choice when querying the same dataset multiple times (autocomplete, live search, file finders).
|
|
271
293
|
|
|
272
294
|
```typescript
|
|
273
295
|
import { FuzzyIndex, FuzzyObjectIndex } from 'rapid-fuzzy';
|
|
@@ -572,6 +594,21 @@ onUnmounted(() => index.destroy());
|
|
|
572
594
|
- `tokenSortRatio`, `tokenSetRatio`, `partialRatio`, `weightedRatio` → float between 0.0 and 1.0
|
|
573
595
|
- `search` → array of `{ item, score, index, positions }` sorted by relevance (score: 0.0–1.0)
|
|
574
596
|
|
|
597
|
+
### Memory Usage
|
|
598
|
+
|
|
599
|
+
`FuzzyIndex` and `FuzzyObjectIndex` store items and precomputed data (UTF-32 representations, character masks, bigram index) on the Rust side. Always call `.destroy()` when the index is no longer needed to free this memory immediately rather than waiting for garbage collection.
|
|
600
|
+
|
|
601
|
+
For read-heavy workloads, prefer `searchIndices()` over `search()` — it returns only indices and scores without cloning item strings back to JavaScript, reducing GC pressure.
|
|
602
|
+
|
|
603
|
+
Serialized indexes use a compact binary format suitable for disk or IndexedDB storage. The serialized size is larger than raw text due to precomputed data, but deserialization is faster than rebuilding.
|
|
604
|
+
|
|
605
|
+
### Error Handling
|
|
606
|
+
|
|
607
|
+
- `hamming()` / `normalizedHamming()` return `null` when the input strings have different lengths.
|
|
608
|
+
- `closest()` returns `null` if no match meets the `minScore` threshold (or if the item list is empty).
|
|
609
|
+
- Calling methods on a `FuzzyIndex` or `FuzzyObjectIndex` after `.destroy()` throws an error.
|
|
610
|
+
- `searchObjects()` and `FuzzyObjectIndex` throw a `TypeError` if `options.keys` is missing or empty.
|
|
611
|
+
|
|
575
612
|
## Benchmarks
|
|
576
613
|
|
|
577
614
|
Measured on Apple M-series with Node.js v22 using [Vitest bench](https://vitest.dev/guide/features.html#benchmarking). Each benchmark processes 6 realistic string pairs of varying length and similarity.
|
|
@@ -647,6 +684,30 @@ Measured on Apple M-series with Node.js v22 using [Vitest bench](https://vitest.
|
|
|
647
684
|
| **Browser** | ✅ WASM (~230 KB gzipped) | ✅ | ✅ | ✅ | ✅ |
|
|
648
685
|
| **TypeScript** | ✅ full | ✅ full | ✅ | ✅ | ✅ |
|
|
649
686
|
|
|
687
|
+
## Troubleshooting
|
|
688
|
+
|
|
689
|
+
### "Cannot find native binding" error
|
|
690
|
+
|
|
691
|
+
The native binary for your platform may not have been installed correctly. Run `npm rebuild rapid-fuzzy` or delete `node_modules` and reinstall. Ensure your platform and architecture are [supported by napi-rs](https://napi.rs/docs/cross-build/summary).
|
|
692
|
+
|
|
693
|
+
### WASM fails to load in the browser
|
|
694
|
+
|
|
695
|
+
Verify that your bundler is configured to handle `.wasm` files. If loading from a CDN, check that the server serves `.wasm` files with the correct `application/wasm` MIME type and that CORS headers allow the request.
|
|
696
|
+
|
|
697
|
+
### SSR or Edge runtime errors
|
|
698
|
+
|
|
699
|
+
Server-side rendering frameworks need to externalize rapid-fuzzy so the native module is not bundled. See [Framework Integration (SSR)](#framework-integration-ssr) above. For edge runtimes (Cloudflare Workers, Deno Deploy), rapid-fuzzy automatically uses the WASM build — see [Browser and Edge Runtime Usage](#browser-and-edge-runtime-usage).
|
|
700
|
+
|
|
701
|
+
### Bun WASM initialization
|
|
702
|
+
|
|
703
|
+
Bun does not yet support the TC39 WebAssembly ESM integration that wasm-bindgen relies on. If you need the WASM build in Bun, initialize it manually — see the [Bun section](#bun) for a complete code example.
|
|
704
|
+
|
|
705
|
+
## Limitations
|
|
706
|
+
|
|
707
|
+
- **WASM memory limit**: The WASM build is subject to the WebAssembly linear memory maximum of 4 GB (65,536 pages of 64 KB). This is sufficient for most use cases but may be a constraint for extremely large datasets.
|
|
708
|
+
- **Synchronous search**: All search and distance functions are synchronous. This is by design — operations are fast enough (sub-millisecond for indexed search) that async overhead would be counterproductive. For large index construction, use `FuzzyIndex.fromAsync()`.
|
|
709
|
+
- **No phonetic or language-specific matching**: rapid-fuzzy focuses on edit-distance and character-level fuzzy matching. It does not perform phonetic matching (e.g., Soundex, Metaphone) or language-specific stemming/lemmatization.
|
|
710
|
+
|
|
650
711
|
## Migration Guides
|
|
651
712
|
|
|
652
713
|
Switching from another library? These guides provide API mapping tables, code examples, and performance comparisons:
|
|
@@ -656,6 +717,9 @@ Switching from another library? These guides provide API mapping tables, code ex
|
|
|
656
717
|
- [**From leven / fastest-levenshtein**](docs/migration/from-leven.md) — Multi-algorithm upgrade with batch APIs
|
|
657
718
|
- [**From fuzzysort**](docs/migration/from-fuzzysort.md) — Richer matching with query syntax and 10 distance algorithms
|
|
658
719
|
- [**From uFuzzy**](docs/migration/from-ufuzzy.md) — Weighted object search, batch APIs, and persistent indexes
|
|
720
|
+
- [**From fuzzball**](docs/migration/from-fuzzball.md) — Same ratio functions (token sort, token set, weighted), now 0.0–1.0 scale
|
|
721
|
+
- [**From FlexSearch**](docs/migration/from-flexsearch.md) — Typo-tolerant fuzzy search to replace exact-token full-text search
|
|
722
|
+
- [**From MiniSearch**](docs/migration/from-minisearch.md) — Faster fuzzy search with richer distance algorithms
|
|
659
723
|
|
|
660
724
|
## License
|
|
661
725
|
|
package/highlight.d.mts
CHANGED
package/index.d.mts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export * from './index.js';
|
|
2
|
-
export { highlight, highlightRanges } from './highlight.js';
|
|
3
1
|
export type { HighlightRange } from './highlight.js';
|
|
4
|
-
export {
|
|
2
|
+
export { highlight, highlightRanges } from './highlight.js';
|
|
3
|
+
export * from './index.js';
|
|
5
4
|
export type {
|
|
6
5
|
KeyConfig,
|
|
7
|
-
ObjectSearchOptions,
|
|
8
|
-
ObjectSearchResult,
|
|
9
6
|
ObjectIndexOptions,
|
|
10
7
|
ObjectIndexSearchOptions,
|
|
8
|
+
ObjectSearchOptions,
|
|
9
|
+
ObjectSearchResult,
|
|
11
10
|
} from './objects.js';
|
|
11
|
+
export { FuzzyObjectIndex, searchObjects } from './objects.js';
|
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 !== '
|
|
81
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
80
|
+
if (bindingPackageVersion !== '2.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 2.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 !== '
|
|
97
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
96
|
+
if (bindingPackageVersion !== '2.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 2.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 !== '
|
|
118
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
117
|
+
if (bindingPackageVersion !== '2.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 2.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 !== '
|
|
134
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
133
|
+
if (bindingPackageVersion !== '2.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 2.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 !== '
|
|
151
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
150
|
+
if (bindingPackageVersion !== '2.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 2.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 !== '
|
|
167
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
166
|
+
if (bindingPackageVersion !== '2.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 2.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 !== '
|
|
186
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
185
|
+
if (bindingPackageVersion !== '2.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 2.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 !== '
|
|
202
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
201
|
+
if (bindingPackageVersion !== '2.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 2.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 !== '
|
|
218
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
217
|
+
if (bindingPackageVersion !== '2.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 2.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 !== '
|
|
238
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
237
|
+
if (bindingPackageVersion !== '2.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 2.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 !== '
|
|
254
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
253
|
+
if (bindingPackageVersion !== '2.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 2.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 !== '
|
|
275
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
274
|
+
if (bindingPackageVersion !== '2.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 2.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 !== '
|
|
291
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
290
|
+
if (bindingPackageVersion !== '2.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 2.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 !== '
|
|
309
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
308
|
+
if (bindingPackageVersion !== '2.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 2.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 !== '
|
|
325
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
324
|
+
if (bindingPackageVersion !== '2.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 2.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 !== '
|
|
343
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
342
|
+
if (bindingPackageVersion !== '2.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 2.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 !== '
|
|
359
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
358
|
+
if (bindingPackageVersion !== '2.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 2.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 !== '
|
|
377
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
376
|
+
if (bindingPackageVersion !== '2.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 2.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 !== '
|
|
393
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
392
|
+
if (bindingPackageVersion !== '2.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 2.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 !== '
|
|
411
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
410
|
+
if (bindingPackageVersion !== '2.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 2.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 !== '
|
|
427
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
426
|
+
if (bindingPackageVersion !== '2.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 2.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 !== '
|
|
444
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
443
|
+
if (bindingPackageVersion !== '2.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 2.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 !== '
|
|
460
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
459
|
+
if (bindingPackageVersion !== '2.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 2.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 !== '
|
|
480
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
479
|
+
if (bindingPackageVersion !== '2.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 2.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 !== '
|
|
496
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
495
|
+
if (bindingPackageVersion !== '2.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 2.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 !== '
|
|
512
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
511
|
+
if (bindingPackageVersion !== '2.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 2.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
513
513
|
}
|
|
514
514
|
return binding
|
|
515
515
|
} catch (e) {
|
package/objects.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export { searchObjects, FuzzyObjectIndex } from './objects.js';
|
|
2
1
|
export type {
|
|
3
2
|
KeyConfig,
|
|
4
|
-
ObjectSearchOptions,
|
|
5
|
-
ObjectSearchResult,
|
|
6
3
|
ObjectIndexOptions,
|
|
7
4
|
ObjectIndexSearchOptions,
|
|
5
|
+
ObjectSearchOptions,
|
|
6
|
+
ObjectSearchResult,
|
|
8
7
|
} from './objects.js';
|
|
8
|
+
export { FuzzyObjectIndex, searchObjects } from './objects.js';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rapid-fuzzy",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "Rust-powered fuzzy search and string distance for JavaScript/TypeScript.
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"description": "Rust-powered fuzzy search and string distance for JavaScript/TypeScript. Up to 15,000x faster than fuse.js with indexed mode.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "derodero24",
|
|
7
7
|
"repository": {
|
|
@@ -9,6 +9,9 @@
|
|
|
9
9
|
"url": "git+https://github.com/derodero24/rapid-fuzzy.git"
|
|
10
10
|
},
|
|
11
11
|
"homepage": "https://github.com/derodero24/rapid-fuzzy",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/derodero24/rapid-fuzzy/issues"
|
|
14
|
+
},
|
|
12
15
|
"keywords": [
|
|
13
16
|
"fuzzy",
|
|
14
17
|
"fuzzy-search",
|
|
@@ -100,9 +103,9 @@
|
|
|
100
103
|
]
|
|
101
104
|
},
|
|
102
105
|
"engines": {
|
|
103
|
-
"node": ">=
|
|
106
|
+
"node": ">=22.0.0"
|
|
104
107
|
},
|
|
105
|
-
"packageManager": "pnpm@10.33.
|
|
108
|
+
"packageManager": "pnpm@10.33.2",
|
|
106
109
|
"scripts": {
|
|
107
110
|
"build": "napi build --manifest-path crates/core/Cargo.toml --platform --release --js index.js --dts index.d.ts --output-dir .",
|
|
108
111
|
"postbuild": "node scripts/patch-binding.js",
|
|
@@ -115,7 +118,7 @@
|
|
|
115
118
|
"artifacts": "napi artifacts",
|
|
116
119
|
"prepublishOnly": "napi prepublish -t npm",
|
|
117
120
|
"version": "napi version",
|
|
118
|
-
"changeset:version": "pnpm changeset version && node scripts/sync-cargo-version.js && napi version && pnpm run build",
|
|
121
|
+
"changeset:version": "pnpm changeset version && node scripts/sync-cargo-version.js && napi version && pnpm run build && pnpm exec biome format --write npm/",
|
|
119
122
|
"check": "biome ci",
|
|
120
123
|
"format": "biome format --write",
|
|
121
124
|
"lint": "biome check",
|
|
@@ -143,8 +146,8 @@
|
|
|
143
146
|
"@codspeed/vitest-plugin": "^5.2.0",
|
|
144
147
|
"@commitlint/cli": "^20.5.0",
|
|
145
148
|
"@commitlint/config-conventional": "^20.5.0",
|
|
146
|
-
"@emnapi/core": "^1.
|
|
147
|
-
"@emnapi/runtime": "^1.
|
|
149
|
+
"@emnapi/core": "^1.10.0",
|
|
150
|
+
"@emnapi/runtime": "^1.10.0",
|
|
148
151
|
"@leeoniya/ufuzzy": "^1.0.19",
|
|
149
152
|
"@napi-rs/cli": "^3.5.1",
|
|
150
153
|
"@napi-rs/wasm-runtime": "^1.1.1",
|
|
@@ -171,6 +174,9 @@
|
|
|
171
174
|
"onlyBuiltDependencies": [
|
|
172
175
|
"lefthook"
|
|
173
176
|
],
|
|
177
|
+
"overrides": {
|
|
178
|
+
"axios": ">=1.15.0"
|
|
179
|
+
},
|
|
174
180
|
"peerDependencyRules": {
|
|
175
181
|
"allowedVersions": {
|
|
176
182
|
"@codspeed/vitest-plugin>vite": "8"
|
|
@@ -178,14 +184,14 @@
|
|
|
178
184
|
}
|
|
179
185
|
},
|
|
180
186
|
"optionalDependencies": {
|
|
181
|
-
"rapid-fuzzy-darwin-x64": "
|
|
182
|
-
"rapid-fuzzy-darwin-arm64": "
|
|
183
|
-
"rapid-fuzzy-linux-x64-gnu": "
|
|
184
|
-
"rapid-fuzzy-linux-x64-musl": "
|
|
185
|
-
"rapid-fuzzy-linux-arm64-gnu": "
|
|
186
|
-
"rapid-fuzzy-linux-arm64-musl": "
|
|
187
|
-
"rapid-fuzzy-win32-x64-msvc": "
|
|
188
|
-
"rapid-fuzzy-win32-arm64-msvc": "
|
|
189
|
-
"rapid-fuzzy-wasm32-wasi": "
|
|
187
|
+
"rapid-fuzzy-darwin-x64": "2.0.0",
|
|
188
|
+
"rapid-fuzzy-darwin-arm64": "2.0.0",
|
|
189
|
+
"rapid-fuzzy-linux-x64-gnu": "2.0.0",
|
|
190
|
+
"rapid-fuzzy-linux-x64-musl": "2.0.0",
|
|
191
|
+
"rapid-fuzzy-linux-arm64-gnu": "2.0.0",
|
|
192
|
+
"rapid-fuzzy-linux-arm64-musl": "2.0.0",
|
|
193
|
+
"rapid-fuzzy-win32-x64-msvc": "2.0.0",
|
|
194
|
+
"rapid-fuzzy-win32-arm64-msvc": "2.0.0",
|
|
195
|
+
"rapid-fuzzy-wasm32-wasi": "2.0.0"
|
|
190
196
|
}
|
|
191
197
|
}
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
*/
|
|
7
7
|
export class FuzzyIndex {
|
|
8
8
|
static __wrap(ptr) {
|
|
9
|
-
ptr = ptr >>> 0;
|
|
10
9
|
const obj = Object.create(FuzzyIndex.prototype);
|
|
11
10
|
obj.__wbg_ptr = ptr;
|
|
12
11
|
FuzzyIndexFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
@@ -102,7 +101,7 @@ export class FuzzyIndex {
|
|
|
102
101
|
const ptr0 = passArrayJsValueToWasm0(items, wasm.__wbindgen_export);
|
|
103
102
|
const len0 = WASM_VECTOR_LEN;
|
|
104
103
|
const ret = wasm.fuzzyindex_new(ptr0, len0);
|
|
105
|
-
this.__wbg_ptr = ret
|
|
104
|
+
this.__wbg_ptr = ret;
|
|
106
105
|
FuzzyIndexFinalization.register(this, this.__wbg_ptr, this);
|
|
107
106
|
return this;
|
|
108
107
|
}
|
|
@@ -178,7 +177,6 @@ if (Symbol.dispose) FuzzyIndex.prototype[Symbol.dispose] = FuzzyIndex.prototype.
|
|
|
178
177
|
*/
|
|
179
178
|
export class KeyedFuzzyIndex {
|
|
180
179
|
static __wrap(ptr) {
|
|
181
|
-
ptr = ptr >>> 0;
|
|
182
180
|
const obj = Object.create(KeyedFuzzyIndex.prototype);
|
|
183
181
|
obj.__wbg_ptr = ptr;
|
|
184
182
|
KeyedFuzzyIndexFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
@@ -243,7 +241,7 @@ export class KeyedFuzzyIndex {
|
|
|
243
241
|
const ptr0 = passStringToWasm0(query, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
244
242
|
const len0 = WASM_VECTOR_LEN;
|
|
245
243
|
const ret = wasm.keyedfuzzyindex_closest(this.__wbg_ptr, ptr0, len0, !isLikeNone(min_score), isLikeNone(min_score) ? 0 : min_score);
|
|
246
|
-
return ret ===
|
|
244
|
+
return ret === Number.MAX_SAFE_INTEGER ? undefined : ret;
|
|
247
245
|
}
|
|
248
246
|
/**
|
|
249
247
|
* Reconstruct a KeyedFuzzyIndex from a previously serialized Uint8Array.
|
|
@@ -294,7 +292,7 @@ export class KeyedFuzzyIndex {
|
|
|
294
292
|
if (r2) {
|
|
295
293
|
throw takeObject(r1);
|
|
296
294
|
}
|
|
297
|
-
this.__wbg_ptr = r0
|
|
295
|
+
this.__wbg_ptr = r0;
|
|
298
296
|
KeyedFuzzyIndexFinalization.register(this, this.__wbg_ptr, this);
|
|
299
297
|
return this;
|
|
300
298
|
} finally {
|
|
@@ -429,7 +427,7 @@ export function damerauLevenshteinMany(reference, candidates, max_distance) {
|
|
|
429
427
|
const len0 = WASM_VECTOR_LEN;
|
|
430
428
|
const ptr1 = passArrayJsValueToWasm0(candidates, wasm.__wbindgen_export);
|
|
431
429
|
const len1 = WASM_VECTOR_LEN;
|
|
432
|
-
wasm.damerauLevenshteinMany(retptr, ptr0, len0, ptr1, len1, isLikeNone(max_distance) ?
|
|
430
|
+
wasm.damerauLevenshteinMany(retptr, ptr0, len0, ptr1, len1, isLikeNone(max_distance) ? Number.MAX_SAFE_INTEGER : (max_distance) >>> 0);
|
|
433
431
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
434
432
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
435
433
|
var v3 = getArrayU32FromWasm0(r0, r1).slice();
|
|
@@ -474,7 +472,7 @@ export function hammingMany(reference, candidates, max_distance) {
|
|
|
474
472
|
const len0 = WASM_VECTOR_LEN;
|
|
475
473
|
const ptr1 = passArrayJsValueToWasm0(candidates, wasm.__wbindgen_export);
|
|
476
474
|
const len1 = WASM_VECTOR_LEN;
|
|
477
|
-
const ret = wasm.hammingMany(ptr0, len0, ptr1, len1, isLikeNone(max_distance) ?
|
|
475
|
+
const ret = wasm.hammingMany(ptr0, len0, ptr1, len1, isLikeNone(max_distance) ? Number.MAX_SAFE_INTEGER : (max_distance) >>> 0);
|
|
478
476
|
return takeObject(ret);
|
|
479
477
|
}
|
|
480
478
|
|
|
@@ -523,7 +521,7 @@ export function indelMany(reference, candidates, max_distance) {
|
|
|
523
521
|
const len0 = WASM_VECTOR_LEN;
|
|
524
522
|
const ptr1 = passArrayJsValueToWasm0(candidates, wasm.__wbindgen_export);
|
|
525
523
|
const len1 = WASM_VECTOR_LEN;
|
|
526
|
-
wasm.indelMany(retptr, ptr0, len0, ptr1, len1, isLikeNone(max_distance) ?
|
|
524
|
+
wasm.indelMany(retptr, ptr0, len0, ptr1, len1, isLikeNone(max_distance) ? Number.MAX_SAFE_INTEGER : (max_distance) >>> 0);
|
|
527
525
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
528
526
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
529
527
|
var v3 = getArrayU32FromWasm0(r0, r1).slice();
|
|
@@ -691,7 +689,7 @@ export function levenshteinMany(reference, candidates, max_distance) {
|
|
|
691
689
|
const len0 = WASM_VECTOR_LEN;
|
|
692
690
|
const ptr1 = passArrayJsValueToWasm0(candidates, wasm.__wbindgen_export);
|
|
693
691
|
const len1 = WASM_VECTOR_LEN;
|
|
694
|
-
wasm.levenshteinMany(retptr, ptr0, len0, ptr1, len1, isLikeNone(max_distance) ?
|
|
692
|
+
wasm.levenshteinMany(retptr, ptr0, len0, ptr1, len1, isLikeNone(max_distance) ? Number.MAX_SAFE_INTEGER : (max_distance) >>> 0);
|
|
695
693
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
696
694
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
697
695
|
var v3 = getArrayU32FromWasm0(r0, r1).slice();
|
|
@@ -1173,11 +1171,11 @@ export function weightedRatioMany(reference, candidates, score_cutoff) {
|
|
|
1173
1171
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1174
1172
|
}
|
|
1175
1173
|
}
|
|
1176
|
-
export function
|
|
1174
|
+
export function __wbg_Error_3639a60ed15f87e7(arg0, arg1) {
|
|
1177
1175
|
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
1178
1176
|
return addHeapObject(ret);
|
|
1179
1177
|
}
|
|
1180
|
-
export function
|
|
1178
|
+
export function __wbg_Number_a3d737fd183f7dca(arg0) {
|
|
1181
1179
|
const ret = Number(getObject(arg0));
|
|
1182
1180
|
return ret;
|
|
1183
1181
|
}
|
|
@@ -1188,46 +1186,46 @@ export function __wbg_String_8564e559799eccda(arg0, arg1) {
|
|
|
1188
1186
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
1189
1187
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
1190
1188
|
}
|
|
1191
|
-
export function
|
|
1189
|
+
export function __wbg___wbindgen_boolean_get_c3dd5c39f1b5a12b(arg0) {
|
|
1192
1190
|
const v = getObject(arg0);
|
|
1193
1191
|
const ret = typeof(v) === 'boolean' ? v : undefined;
|
|
1194
1192
|
return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
|
|
1195
1193
|
}
|
|
1196
|
-
export function
|
|
1194
|
+
export function __wbg___wbindgen_debug_string_07cb72cfcc952e2b(arg0, arg1) {
|
|
1197
1195
|
const ret = debugString(getObject(arg1));
|
|
1198
1196
|
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1199
1197
|
const len1 = WASM_VECTOR_LEN;
|
|
1200
1198
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
1201
1199
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
1202
1200
|
}
|
|
1203
|
-
export function
|
|
1201
|
+
export function __wbg___wbindgen_in_2617fa76397620d3(arg0, arg1) {
|
|
1204
1202
|
const ret = getObject(arg0) in getObject(arg1);
|
|
1205
1203
|
return ret;
|
|
1206
1204
|
}
|
|
1207
|
-
export function
|
|
1205
|
+
export function __wbg___wbindgen_is_function_2f0fd7ceb86e64c5(arg0) {
|
|
1208
1206
|
const ret = typeof(getObject(arg0)) === 'function';
|
|
1209
1207
|
return ret;
|
|
1210
1208
|
}
|
|
1211
|
-
export function
|
|
1209
|
+
export function __wbg___wbindgen_is_object_5b22ff2418063a9c(arg0) {
|
|
1212
1210
|
const val = getObject(arg0);
|
|
1213
1211
|
const ret = typeof(val) === 'object' && val !== null;
|
|
1214
1212
|
return ret;
|
|
1215
1213
|
}
|
|
1216
|
-
export function
|
|
1214
|
+
export function __wbg___wbindgen_is_undefined_244a92c34d3b6ec0(arg0) {
|
|
1217
1215
|
const ret = getObject(arg0) === undefined;
|
|
1218
1216
|
return ret;
|
|
1219
1217
|
}
|
|
1220
|
-
export function
|
|
1218
|
+
export function __wbg___wbindgen_jsval_loose_eq_1978f1e77b4bce62(arg0, arg1) {
|
|
1221
1219
|
const ret = getObject(arg0) == getObject(arg1);
|
|
1222
1220
|
return ret;
|
|
1223
1221
|
}
|
|
1224
|
-
export function
|
|
1222
|
+
export function __wbg___wbindgen_number_get_dd6d69a6079f26f1(arg0, arg1) {
|
|
1225
1223
|
const obj = getObject(arg1);
|
|
1226
1224
|
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
1227
1225
|
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
1228
1226
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
1229
1227
|
}
|
|
1230
|
-
export function
|
|
1228
|
+
export function __wbg___wbindgen_string_get_965592073e5d848c(arg0, arg1) {
|
|
1231
1229
|
const obj = getObject(arg1);
|
|
1232
1230
|
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
1233
1231
|
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
@@ -1235,22 +1233,22 @@ export function __wbg___wbindgen_string_get_395e606bd0ee4427(arg0, arg1) {
|
|
|
1235
1233
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
1236
1234
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
1237
1235
|
}
|
|
1238
|
-
export function
|
|
1236
|
+
export function __wbg___wbindgen_throw_9c75d47bf9e7731e(arg0, arg1) {
|
|
1239
1237
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
1240
1238
|
}
|
|
1241
|
-
export function
|
|
1239
|
+
export function __wbg_call_add9e5a76382e668() { return handleError(function (arg0, arg1) {
|
|
1242
1240
|
const ret = getObject(arg0).call(getObject(arg1));
|
|
1243
1241
|
return addHeapObject(ret);
|
|
1244
1242
|
}, arguments); }
|
|
1245
|
-
export function
|
|
1243
|
+
export function __wbg_done_b1afd6201ac045e0(arg0) {
|
|
1246
1244
|
const ret = getObject(arg0).done;
|
|
1247
1245
|
return ret;
|
|
1248
1246
|
}
|
|
1249
|
-
export function
|
|
1247
|
+
export function __wbg_get_9cfea9b7bbf12a15() { return handleError(function (arg0, arg1) {
|
|
1250
1248
|
const ret = Reflect.get(getObject(arg0), getObject(arg1));
|
|
1251
1249
|
return addHeapObject(ret);
|
|
1252
1250
|
}, arguments); }
|
|
1253
|
-
export function
|
|
1251
|
+
export function __wbg_get_unchecked_be562b1421656321(arg0, arg1) {
|
|
1254
1252
|
const ret = getObject(arg0)[arg1 >>> 0];
|
|
1255
1253
|
return addHeapObject(ret);
|
|
1256
1254
|
}
|
|
@@ -1258,7 +1256,7 @@ export function __wbg_get_with_ref_key_6412cf3094599694(arg0, arg1) {
|
|
|
1258
1256
|
const ret = getObject(arg0)[getObject(arg1)];
|
|
1259
1257
|
return addHeapObject(ret);
|
|
1260
1258
|
}
|
|
1261
|
-
export function
|
|
1259
|
+
export function __wbg_instanceof_ArrayBuffer_eab9f28fbec23477(arg0) {
|
|
1262
1260
|
let result;
|
|
1263
1261
|
try {
|
|
1264
1262
|
result = getObject(arg0) instanceof ArrayBuffer;
|
|
@@ -1268,7 +1266,7 @@ export function __wbg_instanceof_ArrayBuffer_101e2bf31071a9f6(arg0) {
|
|
|
1268
1266
|
const ret = result;
|
|
1269
1267
|
return ret;
|
|
1270
1268
|
}
|
|
1271
|
-
export function
|
|
1269
|
+
export function __wbg_instanceof_Uint8Array_57d77acd50e4c44d(arg0) {
|
|
1272
1270
|
let result;
|
|
1273
1271
|
try {
|
|
1274
1272
|
result = getObject(arg0) instanceof Uint8Array;
|
|
@@ -1278,56 +1276,56 @@ export function __wbg_instanceof_Uint8Array_740438561a5b956d(arg0) {
|
|
|
1278
1276
|
const ret = result;
|
|
1279
1277
|
return ret;
|
|
1280
1278
|
}
|
|
1281
|
-
export function
|
|
1279
|
+
export function __wbg_isArray_c6c6ef8308995bcf(arg0) {
|
|
1282
1280
|
const ret = Array.isArray(getObject(arg0));
|
|
1283
1281
|
return ret;
|
|
1284
1282
|
}
|
|
1285
|
-
export function
|
|
1283
|
+
export function __wbg_isSafeInteger_3c56c421a5b4cce4(arg0) {
|
|
1286
1284
|
const ret = Number.isSafeInteger(getObject(arg0));
|
|
1287
1285
|
return ret;
|
|
1288
1286
|
}
|
|
1289
|
-
export function
|
|
1287
|
+
export function __wbg_iterator_9d68985a1d096fc2() {
|
|
1290
1288
|
const ret = Symbol.iterator;
|
|
1291
1289
|
return addHeapObject(ret);
|
|
1292
1290
|
}
|
|
1293
|
-
export function
|
|
1291
|
+
export function __wbg_length_0a6ce016dc1460b0(arg0) {
|
|
1294
1292
|
const ret = getObject(arg0).length;
|
|
1295
1293
|
return ret;
|
|
1296
1294
|
}
|
|
1297
|
-
export function
|
|
1295
|
+
export function __wbg_length_ba3c032602efe310(arg0) {
|
|
1298
1296
|
const ret = getObject(arg0).length;
|
|
1299
1297
|
return ret;
|
|
1300
1298
|
}
|
|
1301
|
-
export function
|
|
1302
|
-
const ret = new
|
|
1299
|
+
export function __wbg_new_2fad8ca02fd00684() {
|
|
1300
|
+
const ret = new Object();
|
|
1303
1301
|
return addHeapObject(ret);
|
|
1304
1302
|
}
|
|
1305
|
-
export function
|
|
1303
|
+
export function __wbg_new_3baa8d9866155c79() {
|
|
1306
1304
|
const ret = new Array();
|
|
1307
1305
|
return addHeapObject(ret);
|
|
1308
1306
|
}
|
|
1309
|
-
export function
|
|
1310
|
-
const ret = new
|
|
1307
|
+
export function __wbg_new_8454eee672b2ba6e(arg0) {
|
|
1308
|
+
const ret = new Uint8Array(getObject(arg0));
|
|
1311
1309
|
return addHeapObject(ret);
|
|
1312
1310
|
}
|
|
1313
|
-
export function
|
|
1314
|
-
const ret = getObject(arg0).next();
|
|
1315
|
-
return addHeapObject(ret);
|
|
1316
|
-
}, arguments); }
|
|
1317
|
-
export function __wbg_next_e01a967809d1aa68(arg0) {
|
|
1311
|
+
export function __wbg_next_261c3c48c6e309a5(arg0) {
|
|
1318
1312
|
const ret = getObject(arg0).next;
|
|
1319
1313
|
return addHeapObject(ret);
|
|
1320
1314
|
}
|
|
1321
|
-
export function
|
|
1315
|
+
export function __wbg_next_aacee310bcfe6461() { return handleError(function (arg0) {
|
|
1316
|
+
const ret = getObject(arg0).next();
|
|
1317
|
+
return addHeapObject(ret);
|
|
1318
|
+
}, arguments); }
|
|
1319
|
+
export function __wbg_prototypesetcall_fd4050e806e1d519(arg0, arg1, arg2) {
|
|
1322
1320
|
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
|
|
1323
1321
|
}
|
|
1324
|
-
export function __wbg_set_282384002438957f(arg0, arg1, arg2) {
|
|
1325
|
-
getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
|
|
1326
|
-
}
|
|
1327
1322
|
export function __wbg_set_6be42768c690e380(arg0, arg1, arg2) {
|
|
1328
1323
|
getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
|
|
1329
1324
|
}
|
|
1330
|
-
export function
|
|
1325
|
+
export function __wbg_set_f614f6a0608d1d1d(arg0, arg1, arg2) {
|
|
1326
|
+
getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
|
|
1327
|
+
}
|
|
1328
|
+
export function __wbg_value_f852716acdeb3e82(arg0) {
|
|
1331
1329
|
const ret = getObject(arg0).value;
|
|
1332
1330
|
return addHeapObject(ret);
|
|
1333
1331
|
}
|
|
@@ -1350,10 +1348,10 @@ export function __wbindgen_object_drop_ref(arg0) {
|
|
|
1350
1348
|
}
|
|
1351
1349
|
const FuzzyIndexFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1352
1350
|
? { register: () => {}, unregister: () => {} }
|
|
1353
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_fuzzyindex_free(ptr
|
|
1351
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_fuzzyindex_free(ptr, 1));
|
|
1354
1352
|
const KeyedFuzzyIndexFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1355
1353
|
? { register: () => {}, unregister: () => {} }
|
|
1356
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_keyedfuzzyindex_free(ptr
|
|
1354
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_keyedfuzzyindex_free(ptr, 1));
|
|
1357
1355
|
|
|
1358
1356
|
function addHeapObject(obj) {
|
|
1359
1357
|
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
@@ -1467,8 +1465,7 @@ function getFloat64ArrayMemory0() {
|
|
|
1467
1465
|
}
|
|
1468
1466
|
|
|
1469
1467
|
function getStringFromWasm0(ptr, len) {
|
|
1470
|
-
|
|
1471
|
-
return decodeText(ptr, len);
|
|
1468
|
+
return decodeText(ptr >>> 0, len);
|
|
1472
1469
|
}
|
|
1473
1470
|
|
|
1474
1471
|
let cachedUint32ArrayMemory0 = null;
|