rapid-fuzzy 2.0.0 → 2.1.1

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 CHANGED
@@ -197,7 +197,7 @@ search('app', items, { maxResults: 5, minScore: 0.3 });
197
197
 
198
198
  // Get matched character positions for highlighting
199
199
  const [match] = search('hlo', ['hello world'], { includePositions: true });
200
- // → { item: 'hello world', score: 0.75, index: 0, positions: [0, 2, 4] }
200
+ // → { item: 'hello world', score: 0.77, index: 0, positions: [0, 3, 4] }
201
201
 
202
202
  // Case-sensitive matching (default: smart case)
203
203
  search('Type', items, { isCaseSensitive: true });
@@ -370,7 +370,7 @@ const { item, positions } = results[0];
370
370
 
371
371
  // String markers
372
372
  highlight(item, positions, '<b>', '</b>');
373
- // → '<b>f</b>u<b>zy</b>'
373
+ // → '<b>f</b>uz<b>zy</b>'
374
374
 
375
375
  // Callback (React, JSX, custom DOM)
376
376
  highlight(item, positions, (matched) => `<mark>${matched}</mark>`);
@@ -397,13 +397,13 @@ import {
397
397
  tokenSortRatio('New York Mets', 'Mets New York'); // 1.0
398
398
 
399
399
  // Token Set: handles extra/missing tokens
400
- tokenSetRatio('Great Gatsby', 'The Great Gatsby by Fitzgerald'); // ~0.85
400
+ tokenSetRatio('Great Gatsby', 'The Great Gatsby by Fitzgerald'); // 1.0 (all tokens of one side are present)
401
401
 
402
402
  // Partial: best substring match
403
403
  partialRatio('hello', 'hello world'); // 1.0
404
404
 
405
405
  // Weighted: best score across all methods
406
- weightedRatio('John Smith', 'Smith, John'); // 1.0
406
+ weightedRatio('John Smith', 'Smith John'); // 1.0
407
407
  ```
408
408
 
409
409
  All token-based functions include `Batch` and `Many` variants (e.g., `tokenSortRatioBatch`, `tokenSortRatioMany`).
package/highlight.d.ts CHANGED
@@ -17,7 +17,7 @@ export interface HighlightRange {
17
17
  * ```typescript
18
18
  * const results = search('fzy', ['fuzzy'], { includePositions: true });
19
19
  * highlight(results[0].item, results[0].positions, '<b>', '</b>');
20
- * // → '<b>f</b>u<b>zy</b>'
20
+ * // → '<b>f</b>uz<b>zy</b>'
21
21
  * ```
22
22
  *
23
23
  * @example Callback (React, custom DOM, etc.)
package/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  /* auto-generated by NAPI-RS */
2
2
  /* eslint-disable */
3
+
3
4
  /**
4
5
  * A persistent fuzzy search index backed by Rust-side data.
5
6
  *
@@ -27,6 +28,9 @@ export declare class FuzzyIndex {
27
28
  *
28
29
  * Returns matches sorted by score (best match first).
29
30
  * Scores are normalized to a 0.0-1.0 range where 1.0 is a perfect match.
31
+ *
32
+ * The second argument accepts either a number (maxResults shorthand) or a
33
+ * SearchOptions object.
30
34
  */
31
35
  search(query: string, options?: number | SearchOptions | undefined | null): Array<SearchResult>
32
36
  /**
@@ -42,6 +46,9 @@ export declare class FuzzyIndex {
42
46
  * This is more efficient than `search()` when you maintain your own data
43
47
  * array and only need the index to look up the original item. Avoids
44
48
  * String cloning overhead for each result.
49
+ *
50
+ * The second argument accepts either a number (maxResults shorthand) or a
51
+ * SearchOptions object.
45
52
  */
46
53
  searchIndices(query: string, options?: number | SearchOptions | undefined | null): Array<IndexSearchResult>
47
54
  /** Add a single item to the index. */
@@ -356,7 +363,7 @@ export declare const enum MatchType {
356
363
  Exact = 'Exact',
357
364
  Prefix = 'Prefix',
358
365
  Contains = 'Contains',
359
- Fuzzy = 'Fuzzy'
366
+ Fuzzy = 'Fuzzy',
360
367
  }
361
368
 
362
369
  /**
@@ -636,3 +643,16 @@ export declare function tokenSortRatioManyF64(reference: string, candidates: Arr
636
643
  export declare function tokenSetRatioManyF64(reference: string, candidates: Array<string>, minSimilarity?: number | undefined | null): Float64Array;
637
644
  export declare function partialRatioManyF64(reference: string, candidates: Array<string>, minSimilarity?: number | undefined | null): Float64Array;
638
645
  export declare function weightedRatioManyF64(reference: string, candidates: Array<string>, minSimilarity?: number | undefined | null): Float64Array;
646
+ /**
647
+ * TypedArray variant of `hammingMany`. Slots that `hammingMany` returns as `null`
648
+ * (length mismatch, or filtered out by `maxDistance`) become the sentinel `0xffffffff`
649
+ * (4294967295), since a Uint32Array cannot hold `null`. Check for it with
650
+ * `value === 0xffffffff` before treating a slot as a real distance.
651
+ */
652
+ export declare function hammingManyU32(reference: string, candidates: Array<string>, maxDistance?: number | undefined | null): Uint32Array;
653
+ /**
654
+ * TypedArray variant of `normalizedHammingMany`. Slots that `normalizedHammingMany`
655
+ * returns as `null` (length mismatch, or filtered out by `minSimilarity`) become `NaN`,
656
+ * since a Float64Array cannot hold `null`. Check for it with `Number.isNaN(value)`.
657
+ */
658
+ export declare function normalizedHammingManyF64(reference: string, candidates: Array<string>, minSimilarity?: number | undefined | null): Float64Array;
package/index.js CHANGED
@@ -1,9 +1,8 @@
1
- // prettier-ignore
2
1
  /* eslint-disable */
3
2
  // @ts-nocheck
4
3
  /* auto-generated by NAPI-RS */
5
4
 
6
- const { readFileSync } = require('node:fs')
5
+ const { readFileSync } = require('fs')
7
6
  let nativeBinding = null
8
7
  const loadErrors = []
9
8
 
@@ -33,7 +32,7 @@ const isMuslFromFilesystem = () => {
33
32
 
34
33
  const isMuslFromReport = () => {
35
34
  let report = null
36
- if (typeof process.report?.getReport === 'function') {
35
+ if (process.report && typeof process.report.getReport === 'function') {
37
36
  process.report.excludeNetwork = true
38
37
  report = process.report.getReport()
39
38
  }
@@ -63,7 +62,7 @@ const isMuslFromChildProcess = () => {
63
62
  function requireNative() {
64
63
  if (process.env.NAPI_RS_NATIVE_LIBRARY_PATH) {
65
64
  try {
66
- return require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH);
65
+ return require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH)
67
66
  } catch (err) {
68
67
  loadErrors.push(err)
69
68
  }
@@ -77,8 +76,8 @@ function requireNative() {
77
76
  try {
78
77
  const binding = require('rapid-fuzzy-android-arm64')
79
78
  const bindingPackageVersion = require('rapid-fuzzy-android-arm64/package.json').version
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.`)
79
+ if (bindingPackageVersion !== '2.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
80
+ throw new Error(`Native binding package version mismatch, expected 2.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
82
81
  }
83
82
  return binding
84
83
  } catch (e) {
@@ -93,8 +92,8 @@ function requireNative() {
93
92
  try {
94
93
  const binding = require('rapid-fuzzy-android-arm-eabi')
95
94
  const bindingPackageVersion = require('rapid-fuzzy-android-arm-eabi/package.json').version
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.`)
95
+ if (bindingPackageVersion !== '2.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
96
+ throw new Error(`Native binding package version mismatch, expected 2.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
98
97
  }
99
98
  return binding
100
99
  } catch (e) {
@@ -105,38 +104,38 @@ function requireNative() {
105
104
  }
106
105
  } else if (process.platform === 'win32') {
107
106
  if (process.arch === 'x64') {
108
- if (process.config?.variables?.shlib_suffix === 'dll.a' || process.config?.variables?.node_target_type === 'shared_library') {
107
+ if ((process.config && process.config.variables && process.config.variables.shlib_suffix === 'dll.a') || (process.config && process.config.variables && process.config.variables.node_target_type === 'shared_library')) {
109
108
  try {
110
- return require('./rapid-fuzzy.win32-x64-gnu.node')
111
- } catch (e) {
112
- loadErrors.push(e)
113
- }
114
- try {
115
- const binding = require('rapid-fuzzy-win32-x64-gnu')
116
- const bindingPackageVersion = require('rapid-fuzzy-win32-x64-gnu/package.json').version
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.`)
109
+ return require('./rapid-fuzzy.win32-x64-gnu.node')
110
+ } catch (e) {
111
+ loadErrors.push(e)
112
+ }
113
+ try {
114
+ const binding = require('rapid-fuzzy-win32-x64-gnu')
115
+ const bindingPackageVersion = require('rapid-fuzzy-win32-x64-gnu/package.json').version
116
+ if (bindingPackageVersion !== '2.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
117
+ throw new Error(`Native binding package version mismatch, expected 2.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
118
+ }
119
+ return binding
120
+ } catch (e) {
121
+ loadErrors.push(e)
119
122
  }
120
- return binding
121
- } catch (e) {
122
- loadErrors.push(e)
123
- }
124
123
  } else {
125
124
  try {
126
- return require('./rapid-fuzzy.win32-x64-msvc.node')
127
- } catch (e) {
128
- loadErrors.push(e)
129
- }
130
- try {
131
- const binding = require('rapid-fuzzy-win32-x64-msvc')
132
- const bindingPackageVersion = require('rapid-fuzzy-win32-x64-msvc/package.json').version
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.`)
125
+ return require('./rapid-fuzzy.win32-x64-msvc.node')
126
+ } catch (e) {
127
+ loadErrors.push(e)
128
+ }
129
+ try {
130
+ const binding = require('rapid-fuzzy-win32-x64-msvc')
131
+ const bindingPackageVersion = require('rapid-fuzzy-win32-x64-msvc/package.json').version
132
+ if (bindingPackageVersion !== '2.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
133
+ throw new Error(`Native binding package version mismatch, expected 2.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
134
+ }
135
+ return binding
136
+ } catch (e) {
137
+ loadErrors.push(e)
135
138
  }
136
- return binding
137
- } catch (e) {
138
- loadErrors.push(e)
139
- }
140
139
  }
141
140
  } else if (process.arch === 'ia32') {
142
141
  try {
@@ -147,8 +146,8 @@ function requireNative() {
147
146
  try {
148
147
  const binding = require('rapid-fuzzy-win32-ia32-msvc')
149
148
  const bindingPackageVersion = require('rapid-fuzzy-win32-ia32-msvc/package.json').version
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.`)
149
+ if (bindingPackageVersion !== '2.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
150
+ throw new Error(`Native binding package version mismatch, expected 2.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
152
151
  }
153
152
  return binding
154
153
  } catch (e) {
@@ -163,8 +162,8 @@ function requireNative() {
163
162
  try {
164
163
  const binding = require('rapid-fuzzy-win32-arm64-msvc')
165
164
  const bindingPackageVersion = require('rapid-fuzzy-win32-arm64-msvc/package.json').version
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.`)
165
+ if (bindingPackageVersion !== '2.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
166
+ throw new Error(`Native binding package version mismatch, expected 2.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
168
167
  }
169
168
  return binding
170
169
  } catch (e) {
@@ -182,8 +181,8 @@ function requireNative() {
182
181
  try {
183
182
  const binding = require('rapid-fuzzy-darwin-universal')
184
183
  const bindingPackageVersion = require('rapid-fuzzy-darwin-universal/package.json').version
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.`)
184
+ if (bindingPackageVersion !== '2.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
185
+ throw new Error(`Native binding package version mismatch, expected 2.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
187
186
  }
188
187
  return binding
189
188
  } catch (e) {
@@ -198,8 +197,8 @@ function requireNative() {
198
197
  try {
199
198
  const binding = require('rapid-fuzzy-darwin-x64')
200
199
  const bindingPackageVersion = require('rapid-fuzzy-darwin-x64/package.json').version
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.`)
200
+ if (bindingPackageVersion !== '2.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
201
+ throw new Error(`Native binding package version mismatch, expected 2.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
203
202
  }
204
203
  return binding
205
204
  } catch (e) {
@@ -214,8 +213,8 @@ function requireNative() {
214
213
  try {
215
214
  const binding = require('rapid-fuzzy-darwin-arm64')
216
215
  const bindingPackageVersion = require('rapid-fuzzy-darwin-arm64/package.json').version
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.`)
216
+ if (bindingPackageVersion !== '2.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
217
+ throw new Error(`Native binding package version mismatch, expected 2.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
219
218
  }
220
219
  return binding
221
220
  } catch (e) {
@@ -234,8 +233,8 @@ function requireNative() {
234
233
  try {
235
234
  const binding = require('rapid-fuzzy-freebsd-x64')
236
235
  const bindingPackageVersion = require('rapid-fuzzy-freebsd-x64/package.json').version
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.`)
236
+ if (bindingPackageVersion !== '2.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
237
+ throw new Error(`Native binding package version mismatch, expected 2.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
239
238
  }
240
239
  return binding
241
240
  } catch (e) {
@@ -250,8 +249,8 @@ function requireNative() {
250
249
  try {
251
250
  const binding = require('rapid-fuzzy-freebsd-arm64')
252
251
  const bindingPackageVersion = require('rapid-fuzzy-freebsd-arm64/package.json').version
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.`)
252
+ if (bindingPackageVersion !== '2.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
253
+ throw new Error(`Native binding package version mismatch, expected 2.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
255
254
  }
256
255
  return binding
257
256
  } catch (e) {
@@ -271,8 +270,8 @@ function requireNative() {
271
270
  try {
272
271
  const binding = require('rapid-fuzzy-linux-x64-musl')
273
272
  const bindingPackageVersion = require('rapid-fuzzy-linux-x64-musl/package.json').version
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.`)
273
+ if (bindingPackageVersion !== '2.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
274
+ throw new Error(`Native binding package version mismatch, expected 2.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
276
275
  }
277
276
  return binding
278
277
  } catch (e) {
@@ -287,8 +286,8 @@ function requireNative() {
287
286
  try {
288
287
  const binding = require('rapid-fuzzy-linux-x64-gnu')
289
288
  const bindingPackageVersion = require('rapid-fuzzy-linux-x64-gnu/package.json').version
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.`)
289
+ if (bindingPackageVersion !== '2.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
290
+ throw new Error(`Native binding package version mismatch, expected 2.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
292
291
  }
293
292
  return binding
294
293
  } catch (e) {
@@ -305,8 +304,8 @@ function requireNative() {
305
304
  try {
306
305
  const binding = require('rapid-fuzzy-linux-arm64-musl')
307
306
  const bindingPackageVersion = require('rapid-fuzzy-linux-arm64-musl/package.json').version
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.`)
307
+ if (bindingPackageVersion !== '2.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
308
+ throw new Error(`Native binding package version mismatch, expected 2.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
310
309
  }
311
310
  return binding
312
311
  } catch (e) {
@@ -321,8 +320,8 @@ function requireNative() {
321
320
  try {
322
321
  const binding = require('rapid-fuzzy-linux-arm64-gnu')
323
322
  const bindingPackageVersion = require('rapid-fuzzy-linux-arm64-gnu/package.json').version
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.`)
323
+ if (bindingPackageVersion !== '2.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
324
+ throw new Error(`Native binding package version mismatch, expected 2.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
326
325
  }
327
326
  return binding
328
327
  } catch (e) {
@@ -339,8 +338,8 @@ function requireNative() {
339
338
  try {
340
339
  const binding = require('rapid-fuzzy-linux-arm-musleabihf')
341
340
  const bindingPackageVersion = require('rapid-fuzzy-linux-arm-musleabihf/package.json').version
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.`)
341
+ if (bindingPackageVersion !== '2.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
342
+ throw new Error(`Native binding package version mismatch, expected 2.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
344
343
  }
345
344
  return binding
346
345
  } catch (e) {
@@ -355,8 +354,8 @@ function requireNative() {
355
354
  try {
356
355
  const binding = require('rapid-fuzzy-linux-arm-gnueabihf')
357
356
  const bindingPackageVersion = require('rapid-fuzzy-linux-arm-gnueabihf/package.json').version
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.`)
357
+ if (bindingPackageVersion !== '2.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
358
+ throw new Error(`Native binding package version mismatch, expected 2.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
360
359
  }
361
360
  return binding
362
361
  } catch (e) {
@@ -373,8 +372,8 @@ function requireNative() {
373
372
  try {
374
373
  const binding = require('rapid-fuzzy-linux-loong64-musl')
375
374
  const bindingPackageVersion = require('rapid-fuzzy-linux-loong64-musl/package.json').version
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.`)
375
+ if (bindingPackageVersion !== '2.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
376
+ throw new Error(`Native binding package version mismatch, expected 2.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
378
377
  }
379
378
  return binding
380
379
  } catch (e) {
@@ -389,8 +388,8 @@ function requireNative() {
389
388
  try {
390
389
  const binding = require('rapid-fuzzy-linux-loong64-gnu')
391
390
  const bindingPackageVersion = require('rapid-fuzzy-linux-loong64-gnu/package.json').version
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.`)
391
+ if (bindingPackageVersion !== '2.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
392
+ throw new Error(`Native binding package version mismatch, expected 2.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
394
393
  }
395
394
  return binding
396
395
  } catch (e) {
@@ -407,8 +406,8 @@ function requireNative() {
407
406
  try {
408
407
  const binding = require('rapid-fuzzy-linux-riscv64-musl')
409
408
  const bindingPackageVersion = require('rapid-fuzzy-linux-riscv64-musl/package.json').version
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.`)
409
+ if (bindingPackageVersion !== '2.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
410
+ throw new Error(`Native binding package version mismatch, expected 2.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
412
411
  }
413
412
  return binding
414
413
  } catch (e) {
@@ -423,8 +422,8 @@ function requireNative() {
423
422
  try {
424
423
  const binding = require('rapid-fuzzy-linux-riscv64-gnu')
425
424
  const bindingPackageVersion = require('rapid-fuzzy-linux-riscv64-gnu/package.json').version
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.`)
425
+ if (bindingPackageVersion !== '2.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
426
+ throw new Error(`Native binding package version mismatch, expected 2.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
428
427
  }
429
428
  return binding
430
429
  } catch (e) {
@@ -440,8 +439,8 @@ function requireNative() {
440
439
  try {
441
440
  const binding = require('rapid-fuzzy-linux-ppc64-gnu')
442
441
  const bindingPackageVersion = require('rapid-fuzzy-linux-ppc64-gnu/package.json').version
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.`)
442
+ if (bindingPackageVersion !== '2.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
443
+ throw new Error(`Native binding package version mismatch, expected 2.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
445
444
  }
446
445
  return binding
447
446
  } catch (e) {
@@ -456,8 +455,8 @@ function requireNative() {
456
455
  try {
457
456
  const binding = require('rapid-fuzzy-linux-s390x-gnu')
458
457
  const bindingPackageVersion = require('rapid-fuzzy-linux-s390x-gnu/package.json').version
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.`)
458
+ if (bindingPackageVersion !== '2.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
459
+ throw new Error(`Native binding package version mismatch, expected 2.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
461
460
  }
462
461
  return binding
463
462
  } catch (e) {
@@ -476,8 +475,8 @@ function requireNative() {
476
475
  try {
477
476
  const binding = require('rapid-fuzzy-openharmony-arm64')
478
477
  const bindingPackageVersion = require('rapid-fuzzy-openharmony-arm64/package.json').version
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.`)
478
+ if (bindingPackageVersion !== '2.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
479
+ throw new Error(`Native binding package version mismatch, expected 2.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
481
480
  }
482
481
  return binding
483
482
  } catch (e) {
@@ -492,8 +491,8 @@ function requireNative() {
492
491
  try {
493
492
  const binding = require('rapid-fuzzy-openharmony-x64')
494
493
  const bindingPackageVersion = require('rapid-fuzzy-openharmony-x64/package.json').version
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.`)
494
+ if (bindingPackageVersion !== '2.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
495
+ throw new Error(`Native binding package version mismatch, expected 2.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
497
496
  }
498
497
  return binding
499
498
  } catch (e) {
@@ -508,8 +507,8 @@ function requireNative() {
508
507
  try {
509
508
  const binding = require('rapid-fuzzy-openharmony-arm')
510
509
  const bindingPackageVersion = require('rapid-fuzzy-openharmony-arm/package.json').version
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.`)
510
+ if (bindingPackageVersion !== '2.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
511
+ throw new Error(`Native binding package version mismatch, expected 2.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
513
512
  }
514
513
  return binding
515
514
  } catch (e) {
@@ -523,54 +522,178 @@ function requireNative() {
523
522
  }
524
523
  }
525
524
 
526
- nativeBinding = requireNative()
525
+ function createLoadErrorChain(errors) {
526
+ return errors.reduce((previous, current) => {
527
+ let message
528
+ try {
529
+ message =
530
+ current && typeof current.message === 'string'
531
+ ? current.message
532
+ : String(current)
533
+ } catch {
534
+ message = 'Unknown error'
535
+ }
536
+ const error = new Error(message)
537
+ error.cause = previous
538
+ return error
539
+ }, null)
540
+ }
541
+
542
+ // NAPI_RS_FORCE_WASI is a tri-state flag:
543
+ // unset / any other value → native binding preferred, WASI is only a fallback
544
+ // 'true' → prefer WASI, but retain native as a lazy fallback
545
+ // 'error' → require WASI without initializing a native fallback
546
+ // Treating any non-empty string as truthy (the historical behavior) meant
547
+ // NAPI_RS_FORCE_WASI=false, NAPI_RS_FORCE_WASI=0, etc. inadvertently triggered
548
+ // the WASI path, causing ENOENT for packages shipped without a .wasi.cjs file.
549
+ //
550
+ // NAPI_RS_WASI_FLAVOR selects one exact generated flavor and implies strict
551
+ // WASI loading. It never crosses into another flavor or falls back to native.
552
+ const __napiWasiFlavors = ['wasm32-wasi']
553
+ const __napiWasiFlavor = process.env.NAPI_RS_WASI_FLAVOR
554
+ const __napiWasiFlavorRequested =
555
+ typeof __napiWasiFlavor === 'string' && __napiWasiFlavor.length > 0
556
+ if (
557
+ __napiWasiFlavorRequested &&
558
+ __napiWasiFlavors.indexOf(__napiWasiFlavor) === -1
559
+ ) {
560
+ throw new Error(
561
+ 'Unsupported WASI flavor "' +
562
+ __napiWasiFlavor +
563
+ '". Available flavors: ' +
564
+ __napiWasiFlavors.join(', '),
565
+ )
566
+ }
567
+ const forceWasiError = process.env.NAPI_RS_FORCE_WASI === 'error'
568
+ const forceWasi =
569
+ process.env.NAPI_RS_FORCE_WASI === 'true' ||
570
+ forceWasiError ||
571
+ __napiWasiFlavorRequested
572
+
573
+ if (!forceWasi) {
574
+ nativeBinding = requireNative()
575
+ }
527
576
 
528
- if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
577
+ if (!nativeBinding || forceWasi) {
529
578
  let wasiBinding = null
530
- let wasiBindingError = null
531
- try {
532
- wasiBinding = require('./rapid-fuzzy.wasi.cjs')
533
- nativeBinding = wasiBinding
534
- } catch (err) {
535
- if (process.env.NAPI_RS_FORCE_WASI) {
536
- wasiBindingError = err
579
+ let wasiBindingLoaded = false
580
+ const wasiBindingErrors = []
581
+ const __napiWasiResolveCandidate = (specifier, isPackage, localArtifacts) => {
582
+ try {
583
+ require.resolve(specifier)
584
+ } catch (resolveError) {
585
+ if (!resolveError || resolveError.code !== 'MODULE_NOT_FOUND') {
586
+ throw resolveError
587
+ }
588
+ if (isPackage) {
589
+ try {
590
+ require.resolve(specifier + '/package.json')
591
+ } catch (packageError) {
592
+ if (packageError && packageError.code === 'MODULE_NOT_FOUND') {
593
+ return resolveError
594
+ }
595
+ // An exports restriction proves the package exists even when its
596
+ // package.json is not public. Preserve the root resolution failure.
597
+ throw resolveError
598
+ }
599
+ // The package exists but its main/export target is broken.
600
+ throw resolveError
601
+ }
602
+ return resolveError
537
603
  }
604
+ if (localArtifacts) {
605
+ let artifactError = null
606
+ for (let i = 0; i < localArtifacts.length; i++) {
607
+ try {
608
+ require.resolve(localArtifacts[i])
609
+ return null
610
+ } catch (resolveError) {
611
+ if (!resolveError || resolveError.code !== 'MODULE_NOT_FOUND') {
612
+ throw resolveError
613
+ }
614
+ artifactError = resolveError
615
+ }
616
+ }
617
+ return artifactError
618
+ }
619
+ return null
538
620
  }
539
- if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
621
+ if (!wasiBindingLoaded && (!__napiWasiFlavorRequested || __napiWasiFlavor === 'wasm32-wasi')) {
622
+ let candidateError = null
623
+ let candidateFailed = false
540
624
  try {
541
- wasiBinding = require('rapid-fuzzy-wasm32-wasi')
542
- nativeBinding = wasiBinding
625
+ candidateError = __napiWasiResolveCandidate('./rapid-fuzzy.wasi.cjs', false, ['./rapid-fuzzy.wasm32-wasi.debug.wasm', './rapid-fuzzy.wasm32-wasi.wasm'])
626
+ candidateFailed = candidateError !== null
627
+ if (!candidateFailed) {
628
+ wasiBinding = require('./rapid-fuzzy.wasi.cjs')
629
+ nativeBinding = wasiBinding
630
+ wasiBindingLoaded = true
631
+ }
543
632
  } catch (err) {
544
- if (process.env.NAPI_RS_FORCE_WASI) {
545
- if (!wasiBindingError) {
546
- wasiBindingError = err
547
- } else {
548
- wasiBindingError.cause = err
633
+ candidateError = err
634
+ candidateFailed = true
635
+ }
636
+ if (candidateFailed) {
637
+ wasiBindingErrors.push(candidateError)
638
+ loadErrors.push(candidateError)
639
+ }
640
+ }
641
+ if (!wasiBindingLoaded && (!__napiWasiFlavorRequested || __napiWasiFlavor === 'wasm32-wasi')) {
642
+ let candidateError = null
643
+ let candidateFailed = false
644
+ try {
645
+ candidateError = __napiWasiResolveCandidate('rapid-fuzzy-wasm32-wasi', true, undefined)
646
+ candidateFailed = candidateError !== null
647
+ if (!candidateFailed) {
648
+ if (process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
649
+ const bindingPackageVersion = require('rapid-fuzzy-wasm32-wasi/package.json').version
650
+ if (bindingPackageVersion !== '2.1.1') {
651
+ throw new Error(`WASI binding package version mismatch, expected 2.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
652
+ }
549
653
  }
550
- loadErrors.push(err)
654
+ wasiBinding = require('rapid-fuzzy-wasm32-wasi')
655
+ nativeBinding = wasiBinding
656
+ wasiBindingLoaded = true
551
657
  }
658
+ } catch (err) {
659
+ candidateError = err
660
+ candidateFailed = true
661
+ }
662
+ if (candidateFailed) {
663
+ wasiBindingErrors.push(candidateError)
664
+ loadErrors.push(candidateError)
552
665
  }
553
666
  }
554
- if (process.env.NAPI_RS_FORCE_WASI === 'error' && !wasiBinding) {
555
- const error = new Error('WASI binding not found and NAPI_RS_FORCE_WASI is set to error')
556
- error.cause = wasiBindingError
667
+ if (
668
+ !wasiBindingLoaded &&
669
+ forceWasi &&
670
+ !forceWasiError &&
671
+ !__napiWasiFlavorRequested
672
+ ) {
673
+ nativeBinding = requireNative()
674
+ }
675
+ if ((forceWasiError || __napiWasiFlavorRequested) && !wasiBindingLoaded) {
676
+ const error = new Error(
677
+ __napiWasiFlavorRequested
678
+ ? 'WASI binding for flavor "' + __napiWasiFlavor + '" not found'
679
+ : 'WASI binding not found and NAPI_RS_FORCE_WASI is set to error',
680
+ )
681
+ error.cause = createLoadErrorChain(wasiBindingErrors)
557
682
  throw error
558
683
  }
559
684
  }
560
685
 
561
686
  if (!nativeBinding) {
562
687
  if (loadErrors.length > 0) {
563
- throw new Error(
688
+ const error = new Error(
564
689
  `Cannot find native binding. ` +
565
690
  `npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). ` +
566
691
  'Please try `npm i` again after removing both package-lock.json and node_modules directory.',
567
- {
568
- cause: loadErrors.reduce((err, cur) => {
569
- cur.cause = err
570
- return cur
571
- }),
572
- },
573
692
  )
693
+ // assign instead of the `new Error(message, { cause })` options form,
694
+ // which Node < 16.9 silently ignores
695
+ error.cause = createLoadErrorChain(loadErrors)
696
+ throw error
574
697
  }
575
698
  throw new Error(`Failed to load native binding`)
576
699
  }
@@ -642,3 +765,8 @@ module.exports.tokenSortRatioManyF64 = (r, c, s) => new Float64Array(nativeBindi
642
765
  module.exports.tokenSetRatioManyF64 = (r, c, s) => new Float64Array(nativeBinding.tokenSetRatioMany(r, c, s));
643
766
  module.exports.partialRatioManyF64 = (r, c, s) => new Float64Array(nativeBinding.partialRatioMany(r, c, s));
644
767
  module.exports.weightedRatioManyF64 = (r, c, s) => new Float64Array(nativeBinding.weightedRatioMany(r, c, s));
768
+ // hamming variants return null for length mismatches or filtered candidates;
769
+ // the TypedArray cannot hold null, so those slots use a sentinel:
770
+ // hammingManyU32 -> 0xffffffff (4294967295), normalizedHammingManyF64 -> NaN.
771
+ module.exports.hammingManyU32 = (r, c, d) => Uint32Array.from(nativeBinding.hammingMany(r, c, d), (v) => (v == null ? 0xffffffff : v));
772
+ module.exports.normalizedHammingManyF64 = (r, c, s) => Float64Array.from(nativeBinding.normalizedHammingMany(r, c, s), (v) => (v == null ? Number.NaN : v));
package/index.mjs CHANGED
@@ -66,6 +66,8 @@ export const {
66
66
  tokenSetRatioManyF64,
67
67
  partialRatioManyF64,
68
68
  weightedRatioManyF64,
69
+ hammingManyU32,
70
+ normalizedHammingManyF64,
69
71
  } = { ...binding, ...require('./highlight.js') };
70
72
 
71
73
  export const { searchObjects, FuzzyObjectIndex } = require('./objects.js');
package/objects.d.ts CHANGED
@@ -1,22 +1,38 @@
1
1
  import type { SearchOptions } from './index';
2
2
 
3
3
  export interface KeyConfig {
4
+ /**
5
+ * Object key to search. Supports dot-separated paths for nested values,
6
+ * e.g. `'address.city'`.
7
+ */
4
8
  name: string;
9
+ /** Relative weight of this key in the combined score. Defaults to `1.0`. */
5
10
  weight?: number;
6
11
  }
7
12
 
8
13
  /**
9
14
  * Options for searchObjects(). Extends SearchOptions with key configuration.
10
- * Note: `includePositions` has no effect for multi-key search.
15
+ *
16
+ * Note: `includePositions` has no effect for multi-key search — match positions
17
+ * are per-key and are not merged, so the `positions`/`matchType` fields from
18
+ * single-key {@link SearchOptions} are not populated. All other SearchOptions
19
+ * fields (maxResults, minScore, isCaseSensitive, returnAllOnEmpty) apply.
11
20
  */
12
21
  export interface ObjectSearchOptions extends SearchOptions {
13
22
  keys: Array<string | KeyConfig>;
14
23
  }
15
24
 
16
25
  export interface ObjectSearchResult<T> {
26
+ /** The matched object from the original input array. */
17
27
  item: T;
28
+ /** Index of the matched item in the original input array. */
18
29
  index: number;
30
+ /** Combined weighted score normalized to the 0.0–1.0 range. */
19
31
  score: number;
32
+ /**
33
+ * Per-key scores in the same order as the configured keys.
34
+ * A score of 0.0 means the item did not match on that key.
35
+ */
20
36
  keyScores: Array<number>;
21
37
  }
22
38
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rapid-fuzzy",
3
- "version": "2.0.0",
3
+ "version": "2.1.1",
4
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",
@@ -105,13 +105,13 @@
105
105
  "engines": {
106
106
  "node": ">=22.0.0"
107
107
  },
108
- "packageManager": "pnpm@10.33.2",
108
+ "packageManager": "pnpm@12.4.0",
109
109
  "scripts": {
110
110
  "build": "napi build --manifest-path crates/core/Cargo.toml --platform --release --js index.js --dts index.d.ts --output-dir .",
111
111
  "postbuild": "node scripts/patch-binding.js",
112
112
  "build:debug": "napi build --manifest-path crates/core/Cargo.toml --platform --js index.js --dts index.d.ts --output-dir .",
113
113
  "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",
114
- "postbuild:wasm": "node scripts/optimize-wasm.js",
114
+ "postbuild:wasm": "node scripts/optimize-wasm.js && node scripts/patch-binding.js",
115
115
  "build:wasm-bindgen": "node scripts/build-wasm-bindgen.js",
116
116
  "postbuild:wasm-bindgen": "node scripts/optimize-wasm.js",
117
117
  "optimize:wasm": "node scripts/optimize-wasm.js",
@@ -141,57 +141,44 @@
141
141
  "prepare": "lefthook install"
142
142
  },
143
143
  "devDependencies": {
144
- "@biomejs/biome": "^2.4.8",
145
- "@changesets/cli": "^2.30.0",
146
- "@codspeed/vitest-plugin": "^5.2.0",
147
- "@commitlint/cli": "^20.5.0",
148
- "@commitlint/config-conventional": "^20.5.0",
149
- "@emnapi/core": "^1.10.0",
150
- "@emnapi/runtime": "^1.10.0",
144
+ "@biomejs/biome": "^2.5.3",
145
+ "@changesets/cli": "^3.0.2",
146
+ "@codspeed/vitest-plugin": "^5.7.1",
147
+ "@commitlint/cli": "^21.2.1",
148
+ "@commitlint/config-conventional": "^21.2.0",
149
+ "@emnapi/core": "2.0.0-alpha.5",
150
+ "@emnapi/runtime": "2.0.0-alpha.5",
151
151
  "@leeoniya/ufuzzy": "^1.0.19",
152
- "@napi-rs/cli": "^3.5.1",
153
- "@napi-rs/wasm-runtime": "^1.1.1",
154
- "@playwright/test": "^1.58.2",
155
- "@tybys/wasm-util": "^0.10.1",
156
- "@types/node": "^24.0.0",
152
+ "@napi-rs/cli": "^3.9.1",
153
+ "@napi-rs/wasm-runtime": "^1.1.6",
154
+ "@playwright/test": "^1.61.1",
155
+ "@tybys/wasm-util": "^0.10.3",
156
+ "@types/node": "^24.13.2",
157
157
  "@types/string-similarity": "^4.0.2",
158
- "@vitest/coverage-v8": "^4.1.0",
158
+ "@vitest/coverage-v8": "^4.1.10",
159
+ "emnapi": "2.0.0-alpha.5",
159
160
  "fastest-levenshtein": "^1.0.16",
160
161
  "flexsearch": "^0.8.212",
161
162
  "fuse.js": "^7.1.0",
162
163
  "fuzzball": "^2.2.3",
163
- "fuzzysort": "^3.1.0",
164
+ "fuzzysort": "^4.0.2",
164
165
  "lefthook": "^2.1.4",
165
166
  "leven": "^4.1.0",
166
167
  "minisearch": "^7.2.0",
167
168
  "publint": "^0.3.18",
168
169
  "string-similarity": "^4.0.4",
169
- "typescript": "^6.0.0",
170
- "vite": "^8.0.0",
171
- "vitest": "^4.1.0"
172
- },
173
- "pnpm": {
174
- "onlyBuiltDependencies": [
175
- "lefthook"
176
- ],
177
- "overrides": {
178
- "axios": ">=1.15.0"
179
- },
180
- "peerDependencyRules": {
181
- "allowedVersions": {
182
- "@codspeed/vitest-plugin>vite": "8"
183
- }
184
- }
170
+ "typescript": "^7.0.0",
171
+ "vite": "^8.1.4",
172
+ "vitest": "^4.1.10"
185
173
  },
186
174
  "optionalDependencies": {
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"
175
+ "rapid-fuzzy-darwin-x64": "2.1.1",
176
+ "rapid-fuzzy-darwin-arm64": "2.1.1",
177
+ "rapid-fuzzy-linux-x64-gnu": "2.1.1",
178
+ "rapid-fuzzy-linux-x64-musl": "2.1.1",
179
+ "rapid-fuzzy-linux-arm64-gnu": "2.1.1",
180
+ "rapid-fuzzy-linux-arm64-musl": "2.1.1",
181
+ "rapid-fuzzy-win32-x64-msvc": "2.1.1",
182
+ "rapid-fuzzy-win32-arm64-msvc": "2.1.1"
196
183
  }
197
- }
184
+ }
@@ -21,14 +21,14 @@ export interface SearchOptions {
21
21
  export class FuzzyIndex {
22
22
  free(): void;
23
23
  [Symbol.dispose](): void;
24
- /**
25
- * Add a single item to the index.
26
- */
27
- add(item: string): void;
28
24
  /**
29
25
  * Add multiple items to the index at once.
30
26
  */
31
27
  addMany(items: string[]): void;
28
+ /**
29
+ * Add a single item to the index.
30
+ */
31
+ add(item: string): void;
32
32
  /**
33
33
  * Find the closest matching string in the index.
34
34
  *
@@ -53,16 +53,16 @@ export class FuzzyIndex {
53
53
  * Uses swap-remove for O(1) performance. Returns false if out of bounds.
54
54
  */
55
55
  remove(index: number): boolean;
56
+ /**
57
+ * Search the index, returning only indices and scores (no item strings).
58
+ */
59
+ searchIndices(query: string, options?: SearchOptions | null): any;
56
60
  /**
57
61
  * Search the index for items matching the query.
58
62
  *
59
63
  * Returns matches sorted by score (best match first) as a JS Array.
60
64
  */
61
65
  search(query: string, options?: SearchOptions | null): any;
62
- /**
63
- * Search the index, returning only indices and scores (no item strings).
64
- */
65
- searchIndices(query: string, options?: SearchOptions | null): any;
66
66
  /**
67
67
  * Serialize the index to a compact binary format (Uint8Array).
68
68
  */
@@ -81,12 +81,6 @@ export class FuzzyIndex {
81
81
  export class KeyedFuzzyIndex {
82
82
  free(): void;
83
83
  [Symbol.dispose](): void;
84
- /**
85
- * Add a single item to the index.
86
- *
87
- * `key_values` must be a JS Array of strings with one value per key.
88
- */
89
- add(key_values: any): void;
90
84
  /**
91
85
  * Add multiple items to the index at once.
92
86
  *
@@ -94,6 +88,12 @@ export class KeyedFuzzyIndex {
94
88
  * (one per key). Throws if any element has the wrong number of key values.
95
89
  */
96
90
  addMany(items_key_values: any): void;
91
+ /**
92
+ * Add a single item to the index.
93
+ *
94
+ * `key_values` must be a JS Array of strings with one value per key.
95
+ */
96
+ add(key_values: any): void;
97
97
  /**
98
98
  * Find the index of the closest matching item.
99
99
  */
@@ -21,15 +21,6 @@ export class FuzzyIndex {
21
21
  const ptr = this.__destroy_into_raw();
22
22
  wasm.__wbg_fuzzyindex_free(ptr, 0);
23
23
  }
24
- /**
25
- * Add a single item to the index.
26
- * @param {string} item
27
- */
28
- add(item) {
29
- const ptr0 = passStringToWasm0(item, wasm.__wbindgen_export, wasm.__wbindgen_export2);
30
- const len0 = WASM_VECTOR_LEN;
31
- wasm.fuzzyindex_add(this.__wbg_ptr, ptr0, len0);
32
- }
33
24
  /**
34
25
  * Add multiple items to the index at once.
35
26
  * @param {string[]} items
@@ -39,6 +30,15 @@ export class FuzzyIndex {
39
30
  const len0 = WASM_VECTOR_LEN;
40
31
  wasm.fuzzyindex_addMany(this.__wbg_ptr, ptr0, len0);
41
32
  }
33
+ /**
34
+ * Add a single item to the index.
35
+ * @param {string} item
36
+ */
37
+ add(item) {
38
+ const ptr0 = passStringToWasm0(item, wasm.__wbindgen_export, wasm.__wbindgen_export2);
39
+ const len0 = WASM_VECTOR_LEN;
40
+ wasm.fuzzyindex_add(this.__wbg_ptr, ptr0, len0);
41
+ }
42
42
  /**
43
43
  * Find the closest matching string in the index.
44
44
  *
@@ -57,7 +57,7 @@ export class FuzzyIndex {
57
57
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
58
58
  let v2;
59
59
  if (r0 !== 0) {
60
- v2 = getStringFromWasm0(r0, r1).slice();
60
+ v2 = getStringFromWasm0(r0, r1);
61
61
  wasm.__wbindgen_export4(r0, r1 * 1, 1);
62
62
  }
63
63
  return v2;
@@ -117,29 +117,29 @@ export class FuzzyIndex {
117
117
  return ret !== 0;
118
118
  }
119
119
  /**
120
- * Search the index for items matching the query.
121
- *
122
- * Returns matches sorted by score (best match first) as a JS Array.
120
+ * Search the index, returning only indices and scores (no item strings).
123
121
  * @param {string} query
124
122
  * @param {SearchOptions | null} [options]
125
123
  * @returns {any}
126
124
  */
127
- search(query, options) {
125
+ searchIndices(query, options) {
128
126
  const ptr0 = passStringToWasm0(query, wasm.__wbindgen_export, wasm.__wbindgen_export2);
129
127
  const len0 = WASM_VECTOR_LEN;
130
- const ret = wasm.fuzzyindex_search(this.__wbg_ptr, ptr0, len0, isLikeNone(options) ? 0 : addHeapObject(options));
128
+ const ret = wasm.fuzzyindex_searchIndices(this.__wbg_ptr, ptr0, len0, isLikeNone(options) ? 0 : addHeapObject(options));
131
129
  return takeObject(ret);
132
130
  }
133
131
  /**
134
- * Search the index, returning only indices and scores (no item strings).
132
+ * Search the index for items matching the query.
133
+ *
134
+ * Returns matches sorted by score (best match first) as a JS Array.
135
135
  * @param {string} query
136
136
  * @param {SearchOptions | null} [options]
137
137
  * @returns {any}
138
138
  */
139
- searchIndices(query, options) {
139
+ search(query, options) {
140
140
  const ptr0 = passStringToWasm0(query, wasm.__wbindgen_export, wasm.__wbindgen_export2);
141
141
  const len0 = WASM_VECTOR_LEN;
142
- const ret = wasm.fuzzyindex_searchIndices(this.__wbg_ptr, ptr0, len0, isLikeNone(options) ? 0 : addHeapObject(options));
142
+ const ret = wasm.fuzzyindex_search(this.__wbg_ptr, ptr0, len0, isLikeNone(options) ? 0 : addHeapObject(options));
143
143
  return takeObject(ret);
144
144
  }
145
145
  /**
@@ -193,15 +193,16 @@ export class KeyedFuzzyIndex {
193
193
  wasm.__wbg_keyedfuzzyindex_free(ptr, 0);
194
194
  }
195
195
  /**
196
- * Add a single item to the index.
196
+ * Add multiple items to the index at once.
197
197
  *
198
- * `key_values` must be a JS Array of strings with one value per key.
199
- * @param {any} key_values
198
+ * `items_key_values` is a JS Array where each element is an Array of strings
199
+ * (one per key). Throws if any element has the wrong number of key values.
200
+ * @param {any} items_key_values
200
201
  */
201
- add(key_values) {
202
+ addMany(items_key_values) {
202
203
  try {
203
204
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
204
- wasm.keyedfuzzyindex_add(retptr, this.__wbg_ptr, addHeapObject(key_values));
205
+ wasm.keyedfuzzyindex_addMany(retptr, this.__wbg_ptr, addHeapObject(items_key_values));
205
206
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
206
207
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
207
208
  if (r1) {
@@ -212,16 +213,15 @@ export class KeyedFuzzyIndex {
212
213
  }
213
214
  }
214
215
  /**
215
- * Add multiple items to the index at once.
216
+ * Add a single item to the index.
216
217
  *
217
- * `items_key_values` is a JS Array where each element is an Array of strings
218
- * (one per key). Throws if any element has the wrong number of key values.
219
- * @param {any} items_key_values
218
+ * `key_values` must be a JS Array of strings with one value per key.
219
+ * @param {any} key_values
220
220
  */
221
- addMany(items_key_values) {
221
+ add(key_values) {
222
222
  try {
223
223
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
224
- wasm.keyedfuzzyindex_addMany(retptr, this.__wbg_ptr, addHeapObject(items_key_values));
224
+ wasm.keyedfuzzyindex_add(retptr, this.__wbg_ptr, addHeapObject(key_values));
225
225
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
226
226
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
227
227
  if (r1) {
@@ -373,7 +373,7 @@ export function closest(query, items, min_score) {
373
373
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
374
374
  let v3;
375
375
  if (r0 !== 0) {
376
- v3 = getStringFromWasm0(r0, r1).slice();
376
+ v3 = getStringFromWasm0(r0, r1);
377
377
  wasm.__wbindgen_export4(r0, r1 * 1, 1);
378
378
  }
379
379
  return v3;
@@ -1171,11 +1171,11 @@ export function weightedRatioMany(reference, candidates, score_cutoff) {
1171
1171
  wasm.__wbindgen_add_to_stack_pointer(16);
1172
1172
  }
1173
1173
  }
1174
- export function __wbg_Error_3639a60ed15f87e7(arg0, arg1) {
1174
+ export function __wbg_Error_67e7344beaa85059(arg0, arg1) {
1175
1175
  const ret = Error(getStringFromWasm0(arg0, arg1));
1176
1176
  return addHeapObject(ret);
1177
1177
  }
1178
- export function __wbg_Number_a3d737fd183f7dca(arg0) {
1178
+ export function __wbg_Number_c54e7112a3fa7e3e(arg0) {
1179
1179
  const ret = Number(getObject(arg0));
1180
1180
  return ret;
1181
1181
  }
@@ -1186,46 +1186,46 @@ export function __wbg_String_8564e559799eccda(arg0, arg1) {
1186
1186
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1187
1187
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1188
1188
  }
1189
- export function __wbg___wbindgen_boolean_get_c3dd5c39f1b5a12b(arg0) {
1189
+ export function __wbg___wbindgen_boolean_get_7a12af2b3f899c5a(arg0) {
1190
1190
  const v = getObject(arg0);
1191
1191
  const ret = typeof(v) === 'boolean' ? v : undefined;
1192
1192
  return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
1193
1193
  }
1194
- export function __wbg___wbindgen_debug_string_07cb72cfcc952e2b(arg0, arg1) {
1194
+ export function __wbg___wbindgen_debug_string_0e68cf47c9cbd9b0(arg0, arg1) {
1195
1195
  const ret = debugString(getObject(arg1));
1196
1196
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1197
1197
  const len1 = WASM_VECTOR_LEN;
1198
1198
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1199
1199
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1200
1200
  }
1201
- export function __wbg___wbindgen_in_2617fa76397620d3(arg0, arg1) {
1201
+ export function __wbg___wbindgen_in_50072d4d6e45c193(arg0, arg1) {
1202
1202
  const ret = getObject(arg0) in getObject(arg1);
1203
1203
  return ret;
1204
1204
  }
1205
- export function __wbg___wbindgen_is_function_2f0fd7ceb86e64c5(arg0) {
1205
+ export function __wbg___wbindgen_is_function_fcda5e3902d732fe(arg0) {
1206
1206
  const ret = typeof(getObject(arg0)) === 'function';
1207
1207
  return ret;
1208
1208
  }
1209
- export function __wbg___wbindgen_is_object_5b22ff2418063a9c(arg0) {
1209
+ export function __wbg___wbindgen_is_object_edb6b15aa3afe12e(arg0) {
1210
1210
  const val = getObject(arg0);
1211
1211
  const ret = typeof(val) === 'object' && val !== null;
1212
1212
  return ret;
1213
1213
  }
1214
- export function __wbg___wbindgen_is_undefined_244a92c34d3b6ec0(arg0) {
1214
+ export function __wbg___wbindgen_is_undefined_8c687d0b90d5b524(arg0) {
1215
1215
  const ret = getObject(arg0) === undefined;
1216
1216
  return ret;
1217
1217
  }
1218
- export function __wbg___wbindgen_jsval_loose_eq_1978f1e77b4bce62(arg0, arg1) {
1218
+ export function __wbg___wbindgen_jsval_loose_eq_3c30021c243b64cd(arg0, arg1) {
1219
1219
  const ret = getObject(arg0) == getObject(arg1);
1220
1220
  return ret;
1221
1221
  }
1222
- export function __wbg___wbindgen_number_get_dd6d69a6079f26f1(arg0, arg1) {
1222
+ export function __wbg___wbindgen_number_get_1dc732b810cb937c(arg0, arg1) {
1223
1223
  const obj = getObject(arg1);
1224
1224
  const ret = typeof(obj) === 'number' ? obj : undefined;
1225
1225
  getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
1226
1226
  getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
1227
1227
  }
1228
- export function __wbg___wbindgen_string_get_965592073e5d848c(arg0, arg1) {
1228
+ export function __wbg___wbindgen_string_get_92ab86bb19cbc12f(arg0, arg1) {
1229
1229
  const obj = getObject(arg1);
1230
1230
  const ret = typeof(obj) === 'string' ? obj : undefined;
1231
1231
  var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
@@ -1233,22 +1233,22 @@ export function __wbg___wbindgen_string_get_965592073e5d848c(arg0, arg1) {
1233
1233
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1234
1234
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1235
1235
  }
1236
- export function __wbg___wbindgen_throw_9c75d47bf9e7731e(arg0, arg1) {
1236
+ export function __wbg___wbindgen_throw_5d9e815e6fdf150f(arg0, arg1) {
1237
1237
  throw new Error(getStringFromWasm0(arg0, arg1));
1238
1238
  }
1239
- export function __wbg_call_add9e5a76382e668() { return handleError(function (arg0, arg1) {
1239
+ export function __wbg_call_269c5566fbede3eb() { return handleError(function (arg0, arg1) {
1240
1240
  const ret = getObject(arg0).call(getObject(arg1));
1241
1241
  return addHeapObject(ret);
1242
1242
  }, arguments); }
1243
- export function __wbg_done_b1afd6201ac045e0(arg0) {
1243
+ export function __wbg_done_cffed884d87aa22e(arg0) {
1244
1244
  const ret = getObject(arg0).done;
1245
1245
  return ret;
1246
1246
  }
1247
- export function __wbg_get_9cfea9b7bbf12a15() { return handleError(function (arg0, arg1) {
1247
+ export function __wbg_get_6cf5a4d4d8ad3c5a() { return handleError(function (arg0, arg1) {
1248
1248
  const ret = Reflect.get(getObject(arg0), getObject(arg1));
1249
1249
  return addHeapObject(ret);
1250
1250
  }, arguments); }
1251
- export function __wbg_get_unchecked_be562b1421656321(arg0, arg1) {
1251
+ export function __wbg_get_unchecked_363572bdd397d473(arg0, arg1) {
1252
1252
  const ret = getObject(arg0)[arg1 >>> 0];
1253
1253
  return addHeapObject(ret);
1254
1254
  }
@@ -1256,7 +1256,7 @@ export function __wbg_get_with_ref_key_6412cf3094599694(arg0, arg1) {
1256
1256
  const ret = getObject(arg0)[getObject(arg1)];
1257
1257
  return addHeapObject(ret);
1258
1258
  }
1259
- export function __wbg_instanceof_ArrayBuffer_eab9f28fbec23477(arg0) {
1259
+ export function __wbg_instanceof_ArrayBuffer_d4ff01f8247925ae(arg0) {
1260
1260
  let result;
1261
1261
  try {
1262
1262
  result = getObject(arg0) instanceof ArrayBuffer;
@@ -1266,7 +1266,7 @@ export function __wbg_instanceof_ArrayBuffer_eab9f28fbec23477(arg0) {
1266
1266
  const ret = result;
1267
1267
  return ret;
1268
1268
  }
1269
- export function __wbg_instanceof_Uint8Array_57d77acd50e4c44d(arg0) {
1269
+ export function __wbg_instanceof_Uint8Array_598adc0fef426aa8(arg0) {
1270
1270
  let result;
1271
1271
  try {
1272
1272
  result = getObject(arg0) instanceof Uint8Array;
@@ -1276,65 +1276,65 @@ export function __wbg_instanceof_Uint8Array_57d77acd50e4c44d(arg0) {
1276
1276
  const ret = result;
1277
1277
  return ret;
1278
1278
  }
1279
- export function __wbg_isArray_c6c6ef8308995bcf(arg0) {
1279
+ export function __wbg_isArray_5674713bb7b79043(arg0) {
1280
1280
  const ret = Array.isArray(getObject(arg0));
1281
1281
  return ret;
1282
1282
  }
1283
- export function __wbg_isSafeInteger_3c56c421a5b4cce4(arg0) {
1283
+ export function __wbg_isSafeInteger_8f51c743827d1ec5(arg0) {
1284
1284
  const ret = Number.isSafeInteger(getObject(arg0));
1285
1285
  return ret;
1286
1286
  }
1287
- export function __wbg_iterator_9d68985a1d096fc2() {
1287
+ export function __wbg_iterator_22ddeb808cf55a6f() {
1288
1288
  const ret = Symbol.iterator;
1289
1289
  return addHeapObject(ret);
1290
1290
  }
1291
- export function __wbg_length_0a6ce016dc1460b0(arg0) {
1291
+ export function __wbg_length_31bdaf014f5fbde2(arg0) {
1292
1292
  const ret = getObject(arg0).length;
1293
1293
  return ret;
1294
1294
  }
1295
- export function __wbg_length_ba3c032602efe310(arg0) {
1295
+ export function __wbg_length_4e1adc0d42e23620(arg0) {
1296
1296
  const ret = getObject(arg0).length;
1297
1297
  return ret;
1298
1298
  }
1299
- export function __wbg_new_2fad8ca02fd00684() {
1300
- const ret = new Object();
1299
+ export function __wbg_new_1da3429bc3c4541c(arg0) {
1300
+ const ret = new Uint8Array(getObject(arg0));
1301
1301
  return addHeapObject(ret);
1302
1302
  }
1303
- export function __wbg_new_3baa8d9866155c79() {
1304
- const ret = new Array();
1303
+ export function __wbg_new_bebc3f4757acf305() {
1304
+ const ret = new Object();
1305
1305
  return addHeapObject(ret);
1306
1306
  }
1307
- export function __wbg_new_8454eee672b2ba6e(arg0) {
1308
- const ret = new Uint8Array(getObject(arg0));
1307
+ export function __wbg_new_ffa92086ea89f79c() {
1308
+ const ret = new Array();
1309
1309
  return addHeapObject(ret);
1310
1310
  }
1311
- export function __wbg_next_261c3c48c6e309a5(arg0) {
1311
+ export function __wbg_next_95053e306b1c3aed(arg0) {
1312
1312
  const ret = getObject(arg0).next;
1313
1313
  return addHeapObject(ret);
1314
1314
  }
1315
- export function __wbg_next_aacee310bcfe6461() { return handleError(function (arg0) {
1315
+ export function __wbg_next_f31ecb8646d2c605() { return handleError(function (arg0) {
1316
1316
  const ret = getObject(arg0).next();
1317
1317
  return addHeapObject(ret);
1318
1318
  }, arguments); }
1319
- export function __wbg_prototypesetcall_fd4050e806e1d519(arg0, arg1, arg2) {
1319
+ export function __wbg_prototypesetcall_ae9f5e7459250748(arg0, arg1, arg2) {
1320
1320
  Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
1321
1321
  }
1322
+ export function __wbg_set_13d25b81ab403f5e(arg0, arg1, arg2) {
1323
+ getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
1324
+ }
1322
1325
  export function __wbg_set_6be42768c690e380(arg0, arg1, arg2) {
1323
1326
  getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
1324
1327
  }
1325
- export function __wbg_set_f614f6a0608d1d1d(arg0, arg1, arg2) {
1326
- getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
1327
- }
1328
- export function __wbg_value_f852716acdeb3e82(arg0) {
1328
+ export function __wbg_value_c227f843d21da141(arg0) {
1329
1329
  const ret = getObject(arg0).value;
1330
1330
  return addHeapObject(ret);
1331
1331
  }
1332
- export function __wbindgen_cast_0000000000000001(arg0) {
1332
+ export function __wbindgen_generic_0000000000000001(arg0) {
1333
1333
  // Cast intrinsic for `F64 -> Externref`.
1334
1334
  const ret = arg0;
1335
1335
  return addHeapObject(ret);
1336
1336
  }
1337
- export function __wbindgen_cast_0000000000000002(arg0, arg1) {
1337
+ export function __wbindgen_generic_0000000000000002(arg0, arg1) {
1338
1338
  // Cast intrinsic for `Ref(String) -> Externref`.
1339
1339
  const ret = getStringFromWasm0(arg0, arg1);
1340
1340
  return addHeapObject(ret);
Binary file