cmpstr 3.1.0 → 3.2.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.
Files changed (169) hide show
  1. package/LICENSE +2 -2
  2. package/README.md +43 -40
  3. package/dist/CmpStr.esm.js +946 -921
  4. package/dist/CmpStr.esm.js.map +1 -1
  5. package/dist/CmpStr.esm.min.js +2 -2
  6. package/dist/CmpStr.esm.min.js.map +1 -1
  7. package/dist/CmpStr.umd.js +935 -896
  8. package/dist/CmpStr.umd.js.map +1 -1
  9. package/dist/CmpStr.umd.min.js +2 -2
  10. package/dist/CmpStr.umd.min.js.map +1 -1
  11. package/dist/cjs/CmpStr.cjs +26 -44
  12. package/dist/cjs/CmpStr.cjs.map +1 -1
  13. package/dist/cjs/CmpStrAsync.cjs +10 -5
  14. package/dist/cjs/CmpStrAsync.cjs.map +1 -1
  15. package/dist/cjs/index.cjs +1 -1
  16. package/dist/cjs/metric/Cosine.cjs +21 -21
  17. package/dist/cjs/metric/Cosine.cjs.map +1 -1
  18. package/dist/cjs/metric/DamerauLevenshtein.cjs +31 -29
  19. package/dist/cjs/metric/DamerauLevenshtein.cjs.map +1 -1
  20. package/dist/cjs/metric/DiceSorensen.cjs +16 -13
  21. package/dist/cjs/metric/DiceSorensen.cjs.map +1 -1
  22. package/dist/cjs/metric/Hamming.cjs +2 -2
  23. package/dist/cjs/metric/Hamming.cjs.map +1 -1
  24. package/dist/cjs/metric/Jaccard.cjs +16 -13
  25. package/dist/cjs/metric/Jaccard.cjs.map +1 -1
  26. package/dist/cjs/metric/JaroWinkler.cjs +45 -43
  27. package/dist/cjs/metric/JaroWinkler.cjs.map +1 -1
  28. package/dist/cjs/metric/LCS.cjs +21 -18
  29. package/dist/cjs/metric/LCS.cjs.map +1 -1
  30. package/dist/cjs/metric/Levenshtein.cjs +21 -18
  31. package/dist/cjs/metric/Levenshtein.cjs.map +1 -1
  32. package/dist/cjs/metric/Metric.cjs +18 -31
  33. package/dist/cjs/metric/Metric.cjs.map +1 -1
  34. package/dist/cjs/metric/NeedlemanWunsch.cjs +27 -24
  35. package/dist/cjs/metric/NeedlemanWunsch.cjs.map +1 -1
  36. package/dist/cjs/metric/{qGram.cjs → QGram.cjs} +18 -15
  37. package/dist/cjs/metric/QGram.cjs.map +1 -0
  38. package/dist/cjs/metric/SmithWaterman.cjs +27 -24
  39. package/dist/cjs/metric/SmithWaterman.cjs.map +1 -1
  40. package/dist/cjs/phonetic/Caverphone.cjs +5 -8
  41. package/dist/cjs/phonetic/Caverphone.cjs.map +1 -1
  42. package/dist/cjs/phonetic/Cologne.cjs +1 -1
  43. package/dist/cjs/phonetic/Cologne.cjs.map +1 -1
  44. package/dist/cjs/phonetic/Metaphone.cjs +6 -3
  45. package/dist/cjs/phonetic/Metaphone.cjs.map +1 -1
  46. package/dist/cjs/phonetic/Phonetic.cjs +23 -16
  47. package/dist/cjs/phonetic/Phonetic.cjs.map +1 -1
  48. package/dist/cjs/phonetic/Soundex.cjs +1 -1
  49. package/dist/cjs/phonetic/Soundex.cjs.map +1 -1
  50. package/dist/cjs/root.cjs +3 -2
  51. package/dist/cjs/root.cjs.map +1 -1
  52. package/dist/cjs/utils/DeepMerge.cjs +73 -42
  53. package/dist/cjs/utils/DeepMerge.cjs.map +1 -1
  54. package/dist/cjs/utils/DiffChecker.cjs +33 -45
  55. package/dist/cjs/utils/DiffChecker.cjs.map +1 -1
  56. package/dist/cjs/utils/Filter.cjs +40 -46
  57. package/dist/cjs/utils/Filter.cjs.map +1 -1
  58. package/dist/cjs/utils/HashTable.cjs +23 -32
  59. package/dist/cjs/utils/HashTable.cjs.map +1 -1
  60. package/dist/cjs/utils/Normalizer.cjs +32 -21
  61. package/dist/cjs/utils/Normalizer.cjs.map +1 -1
  62. package/dist/cjs/utils/Pool.cjs +21 -26
  63. package/dist/cjs/utils/Pool.cjs.map +1 -1
  64. package/dist/cjs/utils/Profiler.cjs +40 -53
  65. package/dist/cjs/utils/Profiler.cjs.map +1 -1
  66. package/dist/cjs/utils/Registry.cjs +6 -4
  67. package/dist/cjs/utils/Registry.cjs.map +1 -1
  68. package/dist/cjs/utils/StructuredData.cjs +47 -37
  69. package/dist/cjs/utils/StructuredData.cjs.map +1 -1
  70. package/dist/cjs/utils/TextAnalyzer.cjs +76 -56
  71. package/dist/cjs/utils/TextAnalyzer.cjs.map +1 -1
  72. package/dist/esm/CmpStr.mjs +21 -44
  73. package/dist/esm/CmpStr.mjs.map +1 -1
  74. package/dist/esm/CmpStrAsync.mjs +5 -5
  75. package/dist/esm/CmpStrAsync.mjs.map +1 -1
  76. package/dist/esm/index.mjs +1 -1
  77. package/dist/esm/metric/Cosine.mjs +21 -21
  78. package/dist/esm/metric/Cosine.mjs.map +1 -1
  79. package/dist/esm/metric/DamerauLevenshtein.mjs +31 -29
  80. package/dist/esm/metric/DamerauLevenshtein.mjs.map +1 -1
  81. package/dist/esm/metric/DiceSorensen.mjs +16 -13
  82. package/dist/esm/metric/DiceSorensen.mjs.map +1 -1
  83. package/dist/esm/metric/Hamming.mjs +2 -2
  84. package/dist/esm/metric/Hamming.mjs.map +1 -1
  85. package/dist/esm/metric/Jaccard.mjs +16 -13
  86. package/dist/esm/metric/Jaccard.mjs.map +1 -1
  87. package/dist/esm/metric/JaroWinkler.mjs +45 -43
  88. package/dist/esm/metric/JaroWinkler.mjs.map +1 -1
  89. package/dist/esm/metric/LCS.mjs +21 -18
  90. package/dist/esm/metric/LCS.mjs.map +1 -1
  91. package/dist/esm/metric/Levenshtein.mjs +21 -18
  92. package/dist/esm/metric/Levenshtein.mjs.map +1 -1
  93. package/dist/esm/metric/Metric.mjs +19 -32
  94. package/dist/esm/metric/Metric.mjs.map +1 -1
  95. package/dist/esm/metric/NeedlemanWunsch.mjs +27 -24
  96. package/dist/esm/metric/NeedlemanWunsch.mjs.map +1 -1
  97. package/dist/esm/metric/QGram.mjs +38 -0
  98. package/dist/esm/metric/QGram.mjs.map +1 -0
  99. package/dist/esm/metric/SmithWaterman.mjs +27 -24
  100. package/dist/esm/metric/SmithWaterman.mjs.map +1 -1
  101. package/dist/esm/phonetic/Caverphone.mjs +5 -8
  102. package/dist/esm/phonetic/Caverphone.mjs.map +1 -1
  103. package/dist/esm/phonetic/Cologne.mjs +1 -1
  104. package/dist/esm/phonetic/Cologne.mjs.map +1 -1
  105. package/dist/esm/phonetic/Metaphone.mjs +6 -3
  106. package/dist/esm/phonetic/Metaphone.mjs.map +1 -1
  107. package/dist/esm/phonetic/Phonetic.mjs +24 -17
  108. package/dist/esm/phonetic/Phonetic.mjs.map +1 -1
  109. package/dist/esm/phonetic/Soundex.mjs +1 -1
  110. package/dist/esm/phonetic/Soundex.mjs.map +1 -1
  111. package/dist/esm/root.mjs +3 -3
  112. package/dist/esm/utils/DeepMerge.mjs +73 -42
  113. package/dist/esm/utils/DeepMerge.mjs.map +1 -1
  114. package/dist/esm/utils/DiffChecker.mjs +33 -45
  115. package/dist/esm/utils/DiffChecker.mjs.map +1 -1
  116. package/dist/esm/utils/Filter.mjs +40 -46
  117. package/dist/esm/utils/Filter.mjs.map +1 -1
  118. package/dist/esm/utils/HashTable.mjs +23 -33
  119. package/dist/esm/utils/HashTable.mjs.map +1 -1
  120. package/dist/esm/utils/Normalizer.mjs +32 -21
  121. package/dist/esm/utils/Normalizer.mjs.map +1 -1
  122. package/dist/esm/utils/Pool.mjs +21 -26
  123. package/dist/esm/utils/Pool.mjs.map +1 -1
  124. package/dist/esm/utils/Profiler.mjs +40 -53
  125. package/dist/esm/utils/Profiler.mjs.map +1 -1
  126. package/dist/esm/utils/Registry.mjs +6 -4
  127. package/dist/esm/utils/Registry.mjs.map +1 -1
  128. package/dist/esm/utils/StructuredData.mjs +47 -37
  129. package/dist/esm/utils/StructuredData.mjs.map +1 -1
  130. package/dist/esm/utils/TextAnalyzer.mjs +76 -56
  131. package/dist/esm/utils/TextAnalyzer.mjs.map +1 -1
  132. package/dist/types/CmpStr.d.ts +56 -55
  133. package/dist/types/CmpStrAsync.d.ts +45 -45
  134. package/dist/types/index.d.ts +2 -2
  135. package/dist/types/metric/Cosine.d.ts +7 -5
  136. package/dist/types/metric/DamerauLevenshtein.d.ts +4 -2
  137. package/dist/types/metric/DiceSorensen.d.ts +5 -3
  138. package/dist/types/metric/Hamming.d.ts +4 -2
  139. package/dist/types/metric/Jaccard.d.ts +3 -1
  140. package/dist/types/metric/JaroWinkler.d.ts +4 -2
  141. package/dist/types/metric/LCS.d.ts +3 -1
  142. package/dist/types/metric/Levenshtein.d.ts +4 -2
  143. package/dist/types/metric/Metric.d.ts +23 -21
  144. package/dist/types/metric/NeedlemanWunsch.d.ts +4 -2
  145. package/dist/types/metric/{qGram.d.ts → QGram.d.ts} +5 -3
  146. package/dist/types/metric/SmithWaterman.d.ts +4 -2
  147. package/dist/types/metric/index.d.ts +2 -2
  148. package/dist/types/phonetic/Caverphone.d.ts +5 -2
  149. package/dist/types/phonetic/Cologne.d.ts +1 -0
  150. package/dist/types/phonetic/Metaphone.d.ts +3 -0
  151. package/dist/types/phonetic/Phonetic.d.ts +14 -10
  152. package/dist/types/phonetic/Soundex.d.ts +1 -0
  153. package/dist/types/phonetic/index.d.ts +1 -1
  154. package/dist/types/root.d.ts +7 -7
  155. package/dist/types/utils/DeepMerge.d.ts +4 -3
  156. package/dist/types/utils/DiffChecker.d.ts +9 -7
  157. package/dist/types/utils/Filter.d.ts +22 -8
  158. package/dist/types/utils/HashTable.d.ts +44 -10
  159. package/dist/types/utils/Normalizer.d.ts +13 -4
  160. package/dist/types/utils/Pool.d.ts +5 -3
  161. package/dist/types/utils/Profiler.d.ts +30 -15
  162. package/dist/types/utils/Registry.d.ts +11 -8
  163. package/dist/types/utils/StructuredData.d.ts +44 -32
  164. package/dist/types/utils/TextAnalyzer.d.ts +38 -14
  165. package/dist/types/utils/Types.d.ts +104 -14
  166. package/package.json +8 -3
  167. package/dist/cjs/metric/qGram.cjs.map +0 -1
  168. package/dist/esm/metric/qGram.mjs +0 -35
  169. package/dist/esm/metric/qGram.mjs.map +0 -1
@@ -20,12 +20,12 @@
20
20
  * @author Paul Köhler (komed3)
21
21
  * @license MIT
22
22
  */
23
- import type { CmpStrOptions, CmpStrProcessors, CmpStrResult, NormalizeFlags, DiffOptions, PhoneticOptions, MetricRaw, MetricInput, MetricMode, MetricResult, MetricResultSingle, MetricResultBatch, StructuredDataBatchResult, StructuredDataOptions } from './utils/Types';
24
- import { TextAnalyzer } from './utils/TextAnalyzer';
23
+ import type { BatchResultLike, CmpStrOptions, CmpStrProcessors, CmpStrResult, DiffOptions, MetricInput, MetricMode, MetricRaw, MetricResult, NormalizeFlags, PhoneticOptions, ResultLike, StructuredDataOptions, StructuredResultLike } from './utils/Types';
25
24
  import { DiffChecker } from './utils/DiffChecker';
26
- import { Normalizer } from './utils/Normalizer';
27
25
  import { Filter } from './utils/Filter';
26
+ import { Normalizer } from './utils/Normalizer';
28
27
  import { StructuredData } from './utils/StructuredData';
28
+ import { TextAnalyzer } from './utils/TextAnalyzer';
29
29
  import { Metric } from './metric';
30
30
  import { Phonetic } from './phonetic';
31
31
  /**
@@ -36,9 +36,9 @@ import { Phonetic } from './phonetic';
36
36
  */
37
37
  export declare class CmpStr<R = MetricRaw> {
38
38
  /**
39
- * --------------------------------------------------------------------------------
39
+ * ================================================================================
40
40
  * Static methods and properties for global access to CmpStr features
41
- * --------------------------------------------------------------------------------
41
+ * ================================================================================
42
42
  *
43
43
  * These static methods provide a convenient way to access the core features of
44
44
  * the CmpStr package without needing to instantiate a CmpStr object.
@@ -49,6 +49,7 @@ export declare class CmpStr<R = MetricRaw> {
49
49
  * @see Filter
50
50
  */
51
51
  static readonly filter: {
52
+ has: typeof Filter.has;
52
53
  add: typeof Filter.add;
53
54
  remove: typeof Filter.remove;
54
55
  pause: typeof Filter.pause;
@@ -95,8 +96,8 @@ export declare class CmpStr<R = MetricRaw> {
95
96
  */
96
97
  static readonly clearCache: {
97
98
  normalizer: typeof Normalizer.clear;
98
- metric: typeof Metric.clear;
99
- phonetic: typeof Phonetic.clear;
99
+ metric: () => void;
100
+ phonetic: () => void;
100
101
  };
101
102
  /**
102
103
  * Returns a TextAnalyzer instance for the given input string.
@@ -104,7 +105,7 @@ export declare class CmpStr<R = MetricRaw> {
104
105
  * @param {string} [input] - The input string
105
106
  * @returns {TextAnalyzer} - The text analyzer
106
107
  */
107
- static analyze(input: string): TextAnalyzer;
108
+ static analyze: (input: string) => TextAnalyzer;
108
109
  /**
109
110
  * Returns a DiffChecker instance for computing the unified diff between two texts.
110
111
  *
@@ -113,11 +114,11 @@ export declare class CmpStr<R = MetricRaw> {
113
114
  * @param {DiffOptions} [opt] - Optional diff configuration
114
115
  * @returns {DiffChecker} - The diff checker instance
115
116
  */
116
- static diff(a: string, b: string, opt?: DiffOptions): DiffChecker;
117
+ static diff: (a: string, b: string, opt?: DiffOptions) => DiffChecker;
117
118
  /**
118
- * --------------------------------------------------------------------------------
119
+ * ================================================================================
119
120
  * Instanciate the CmpStr class
120
- * --------------------------------------------------------------------------------
121
+ * ================================================================================
121
122
  *
122
123
  * Methods to create a new CmpStr instance with the given options.
123
124
  * Using the static `create` method is recommended to ensure proper instantiation.
@@ -125,8 +126,8 @@ export declare class CmpStr<R = MetricRaw> {
125
126
  /**
126
127
  * Creates a new CmpStr instance with the given options.
127
128
  *
128
- * @param {string|CmpStrOptions} [opt] - Optional serialized or options object
129
- * @returns {CmpStr<R>} - A new CmpStr instance
129
+ * @param {string | CmpStrOptions} [opt] - Optional serialized or options object
130
+ * @returns {CmpStr< R >} - A new CmpStr instance
130
131
  */
131
132
  static create<R = MetricRaw>(opt?: string | CmpStrOptions): CmpStr<R>;
132
133
  protected options: CmpStrOptions;
@@ -134,13 +135,13 @@ export declare class CmpStr<R = MetricRaw> {
134
135
  * Creates a new CmpStr instance with the given options.
135
136
  * The constructor is protected to enforce the use of the static `create` method.
136
137
  *
137
- * @param {string|CmpStrOptions} [opt] - Optional serialized or options object
138
+ * @param {string | CmpStrOptions} [opt] - Optional serialized or options object
138
139
  */
139
140
  protected constructor(opt?: string | CmpStrOptions);
140
141
  /**
141
- * ---------------------------------------------------------------------------------
142
+ * ================================================================================-
142
143
  * Protected utility methods for internal use
143
- * ---------------------------------------------------------------------------------
144
+ * ================================================================================-
144
145
  *
145
146
  * These methods provide utility functions for converting inputs, merging options,
146
147
  * normalizing inputs, filtering, and preparing inputs for comparison.
@@ -194,8 +195,8 @@ export declare class CmpStr<R = MetricRaw> {
194
195
  /**
195
196
  * Post-process the results of the metric computation.
196
197
  *
197
- * @param {MetricResult<R>} result - The metric result
198
- * @returns {MetricResult<R>} - The post-processed results
198
+ * @param {MetricResult< R >} result - The metric result
199
+ * @returns {MetricResult< R >} - The post-processed results
199
200
  */
200
201
  protected postProcess(result: MetricResult<R>, opt?: CmpStrOptions): MetricResult<R>;
201
202
  /**
@@ -215,7 +216,7 @@ export declare class CmpStr<R = MetricRaw> {
215
216
  * @template T - The type of objects in the data array
216
217
  * @param {T[]} data - The array of structured objects
217
218
  * @param {keyof T} key - The property key to compare
218
- * @returns {StructuredData<T, R>} - The lookup instance
219
+ * @returns {StructuredData< T, R >} - The lookup instance
219
220
  */
220
221
  protected structured<T = any>(data: T[], key: keyof T): StructuredData<T, R>;
221
222
  /**
@@ -236,15 +237,15 @@ export declare class CmpStr<R = MetricRaw> {
236
237
  * Resolves the result format (raw or formatted).
237
238
  *
238
239
  * @template T - The type of the metric result
239
- * @param {MetricResult<R>} result - The metric result
240
+ * @param {MetricResult< R >} result - The metric result
240
241
  * @param {boolean} [raw] - Whether to return raw results
241
242
  * @returns {T} - The resolved result
242
243
  */
243
244
  protected output<T extends MetricResult<R> | CmpStrResult | CmpStrResult[]>(result: MetricResult<R>, raw?: boolean): T;
244
245
  /**
245
- * ---------------------------------------------------------------------------------
246
+ * ================================================================================-
246
247
  * Managing methods for CmpStr
247
- * ---------------------------------------------------------------------------------
248
+ * ================================================================================-
248
249
  *
249
250
  * These methods provides an interface to set and get properties of the CmpStr
250
251
  * instance, such as options, metric, phonetic algorithm, and more.
@@ -252,9 +253,9 @@ export declare class CmpStr<R = MetricRaw> {
252
253
  /**
253
254
  * Creates a shallow clone of the current instance.
254
255
  *
255
- * @returns {CmpStr<R>} - The cloned instance
256
+ * @returns {CmpStr< R >} - The cloned instance
256
257
  */
257
- clone(): CmpStr<R>;
258
+ clone: () => CmpStr<R>;
258
259
  /**
259
260
  * Resets the instance, clearing all data and options.
260
261
  *
@@ -303,63 +304,63 @@ export declare class CmpStr<R = MetricRaw> {
303
304
  * @param {boolean} enable - Whether to enable or disable raw output
304
305
  * @returns {this}
305
306
  */
306
- setRaw(enable: boolean): this;
307
+ setRaw: (enable: boolean) => this;
307
308
  /**
308
309
  * Sets the similatity metric to use (e.g., 'levenshtein', 'dice').
309
310
  *
310
311
  * @param {string} name - The metric name
311
312
  * @returns {this}
312
313
  */
313
- setMetric(name: string): this;
314
+ setMetric: (name: string) => this;
314
315
  /**
315
316
  * Sets the normalization flags (e.g., 'itw', 'nfc').
316
317
  *
317
318
  * @param {NormalizeFlags} flags - The normalization flags
318
319
  * @returns {this}
319
320
  */
320
- setFlags(flags: NormalizeFlags): this;
321
+ setFlags: (flags: NormalizeFlags) => this;
321
322
  /**
322
323
  * Removes the normalization flags entirely.
323
324
  *
324
325
  * @return {this}
325
326
  */
326
- rmvFlags(): this;
327
+ rmvFlags: () => this;
327
328
  /**
328
329
  * Sets the pre-processors to use for preparing the input.
329
330
  *
330
331
  * @param {CmpStrProcessors} opt - The processors to set
331
332
  * @returns {this}
332
333
  */
333
- setProcessors(opt: CmpStrProcessors): this;
334
+ setProcessors: (opt: CmpStrProcessors) => this;
334
335
  /**
335
336
  * Removes the processors entirely.
336
337
  *
337
338
  * @returns {this}
338
339
  */
339
- rmvProcessors(): this;
340
+ rmvProcessors: () => this;
340
341
  /**
341
342
  * Returns the current options object.
342
343
  *
343
344
  * @returns {CmpStrOptions} - The options
344
345
  */
345
- getOptions(): CmpStrOptions;
346
+ getOptions: () => CmpStrOptions;
346
347
  /**
347
348
  * Returns the options as a JSON string.
348
349
  *
349
350
  * @returns {string} - The serialized options
350
351
  */
351
- getSerializedOptions(): string;
352
+ getSerializedOptions: () => string;
352
353
  /**
353
354
  * Returns a specific option value by path.
354
355
  *
355
356
  * @param {string} path - The path to the option
356
357
  * @returns {any} - The option value
357
358
  */
358
- getOption(path: string): any;
359
+ getOption: (path: string) => any;
359
360
  /**
360
- * ---------------------------------------------------------------------------------
361
+ * ================================================================================-
361
362
  * Public core methods for string comparison
362
- * ---------------------------------------------------------------------------------
363
+ * ================================================================================-
363
364
  *
364
365
  * These methods provide the core functionality of the CmpStr class, allowing for
365
366
  * string comparison, phonetic indexing, filtering, and text search.
@@ -373,7 +374,7 @@ export declare class CmpStr<R = MetricRaw> {
373
374
  * @param {CmpStrOptions} [opt] - Optional options
374
375
  * @returns {T} - The metric result
375
376
  */
376
- test<T extends CmpStrResult | MetricResultSingle<R> = any>(a: string, b: string, opt?: CmpStrOptions): T;
377
+ test<T extends ResultLike<R> = any>(a: string, b: string, opt?: CmpStrOptions): T;
377
378
  /**
378
379
  * Performs a single metric comparison and returns only the numeric score.
379
380
  *
@@ -393,18 +394,18 @@ export declare class CmpStr<R = MetricRaw> {
393
394
  * @param {CmpStrOptions} [opt] - Optional options
394
395
  * @returns {T} - The batch metric results
395
396
  */
396
- batchTest<T extends CmpStrResult[] | MetricResultBatch<R> = any>(a: MetricInput, b: MetricInput, opt?: CmpStrOptions): T;
397
+ batchTest<T extends BatchResultLike<R> = any>(a: MetricInput, b: MetricInput, opt?: CmpStrOptions): T;
397
398
  /**
398
399
  * Performs a batch metric comparison and returns results sorted by score.
399
400
  *
400
401
  * @template T - The type of the metric result
401
402
  * @param {MetricInput} a - The source string or array of strings
402
403
  * @param {MetricInput} b - The target string or array of strings
403
- * @param {'desc'|'asc'} [dir='desc'] - Sort direction (desc, asc)
404
+ * @param {'desc' | 'asc'} [dir='desc'] - Sort direction (desc, asc)
404
405
  * @param {CmpStrOptions} [opt] - Optional options
405
406
  * @returns {T} - The sorted batch results
406
407
  */
407
- batchSorted<T extends CmpStrResult[] | MetricResultBatch<R> = any>(a: MetricInput, b: MetricInput, dir?: 'desc' | 'asc', opt?: CmpStrOptions): T;
408
+ batchSorted<T extends BatchResultLike<R> = any>(a: MetricInput, b: MetricInput, dir?: 'desc' | 'asc', opt?: CmpStrOptions): T;
408
409
  /**
409
410
  * Performs a pairwise metric comparison between source and target strings
410
411
  * or array of strings.
@@ -418,7 +419,7 @@ export declare class CmpStr<R = MetricRaw> {
418
419
  * @param {CmpStrOptions} [opt] - Optional options
419
420
  * @returns {T} - The pairwise metric results
420
421
  */
421
- pairs<T extends CmpStrResult[] | MetricResultBatch<R> = any>(a: MetricInput, b: MetricInput, opt?: CmpStrOptions): T;
422
+ pairs<T extends BatchResultLike<R> = any>(a: MetricInput, b: MetricInput, opt?: CmpStrOptions): T;
422
423
  /**
423
424
  * Performs a batch comparison and returns only results above the threshold.
424
425
  *
@@ -429,7 +430,7 @@ export declare class CmpStr<R = MetricRaw> {
429
430
  * @param {CmpStrOptions} [opt] - Optional options
430
431
  * @returns {T} - The filtered batch results
431
432
  */
432
- match<T extends CmpStrResult[] | MetricResultBatch<R> = any>(a: MetricInput, b: MetricInput, threshold: number, opt?: CmpStrOptions): T;
433
+ match<T extends BatchResultLike<R> = any>(a: MetricInput, b: MetricInput, threshold: number, opt?: CmpStrOptions): T;
433
434
  /**
434
435
  * Returns the n closest matches from a batch comparison.
435
436
  *
@@ -440,7 +441,7 @@ export declare class CmpStr<R = MetricRaw> {
440
441
  * @param {CmpStrOptions} [opt] - Optional options
441
442
  * @returns {T} - The closest matches
442
443
  */
443
- closest<T extends CmpStrResult[] | MetricResultBatch<R> = any>(a: MetricInput, b: MetricInput, n?: number, opt?: CmpStrOptions): T;
444
+ closest<T extends BatchResultLike<R> = any>(a: MetricInput, b: MetricInput, n?: number, opt?: CmpStrOptions): T;
444
445
  /**
445
446
  * Returns the n furthest matches from a batch comparison.
446
447
  *
@@ -451,7 +452,7 @@ export declare class CmpStr<R = MetricRaw> {
451
452
  * @param {CmpStrOptions} [opt] - Optional options
452
453
  * @returns {T} - The furthest matches
453
454
  */
454
- furthest<T extends CmpStrResult[] | MetricResultBatch<R> = any>(a: MetricInput, b: MetricInput, n?: number, opt?: CmpStrOptions): T;
455
+ furthest<T extends BatchResultLike<R> = any>(a: MetricInput, b: MetricInput, n?: number, opt?: CmpStrOptions): T;
455
456
  /**
456
457
  * Performs a normalized and filtered substring search.
457
458
  *
@@ -481,9 +482,9 @@ export declare class CmpStr<R = MetricRaw> {
481
482
  */
482
483
  phoneticIndex(input: string, algo?: string, opt?: PhoneticOptions): string;
483
484
  /**
484
- * ---------------------------------------------------------------------------------
485
+ * ================================================================================-
485
486
  * Public methods for structured data comparison
486
- * ---------------------------------------------------------------------------------
487
+ * ================================================================================-
487
488
  *
488
489
  * These methods provide interfaces for comparing arrays of structured objects
489
490
  * by extracting and comparing specific properties.
@@ -497,9 +498,9 @@ export declare class CmpStr<R = MetricRaw> {
497
498
  * @param {T[]} data - The array of structured objects
498
499
  * @param {keyof T} key - The property key to extract for comparison
499
500
  * @param {StructuredDataOptions} [opt] - Optional lookup options
500
- * @returns {StructuredDataBatchResult<T, R>|T[]} - Batch results with original objects
501
+ * @returns {StructuredResultLike< T, R >} - Batch results with original objects
501
502
  */
502
- structuredLookup<T = any>(query: string, data: T[], key: keyof T, opt?: StructuredDataOptions): StructuredDataBatchResult<T, R> | T[];
503
+ structuredLookup<T = any>(query: string, data: T[], key: keyof T, opt?: StructuredDataOptions): StructuredResultLike<T, R>;
503
504
  /**
504
505
  * Performs a batch comparison and returns only results above the threshold
505
506
  * for structured data.
@@ -510,9 +511,9 @@ export declare class CmpStr<R = MetricRaw> {
510
511
  * @param {keyof T} key - The property key to extract for comparison
511
512
  * @param {number} threshold - The similarity threshold (0..1)
512
513
  * @param {StructuredDataOptions} [opt] - Optional lookup options
513
- * @returns {StructuredDataBatchResult<T, R>|T[]} - Filtered batch results with objects
514
+ * @returns {StructuredResultLike< T, R >} - Filtered batch results with objects
514
515
  */
515
- structuredMatch<T = any>(query: string, data: T[], key: keyof T, threshold: number, opt?: StructuredDataOptions): StructuredDataBatchResult<T, R> | T[];
516
+ structuredMatch<T = any>(query: string, data: T[], key: keyof T, threshold: number, opt?: StructuredDataOptions): StructuredResultLike<T, R>;
516
517
  /**
517
518
  * Returns the n closest matches from a batch comparison of structured data.
518
519
  *
@@ -522,9 +523,9 @@ export declare class CmpStr<R = MetricRaw> {
522
523
  * @param {keyof T} key - The property key to extract for comparison
523
524
  * @param {number} [n=1] - Number of closest matches
524
525
  * @param {StructuredDataOptions} [opt] - Optional lookup options
525
- * @returns {StructuredDataBatchResult<T, R>|T[]} - Closest matches with objects
526
+ * @returns {StructuredResultLike< T, R >} - Closest matches with objects
526
527
  */
527
- structuredClosest<T = any>(query: string, data: T[], key: keyof T, n?: number, opt?: StructuredDataOptions): StructuredDataBatchResult<T, R> | T[];
528
+ structuredClosest<T = any>(query: string, data: T[], key: keyof T, n?: number, opt?: StructuredDataOptions): StructuredResultLike<T, R>;
528
529
  /**
529
530
  * Returns the n furthest matches from a batch comparison of structured data.
530
531
  *
@@ -534,9 +535,9 @@ export declare class CmpStr<R = MetricRaw> {
534
535
  * @param {keyof T} key - The property key to extract for comparison
535
536
  * @param {number} [n=1] - Number of furthest matches
536
537
  * @param {StructuredDataOptions} [opt] - Optional lookup options
537
- * @returns {StructuredDataBatchResult<T, R>|T[]} - Furthest matches with objects
538
+ * @returns {StructuredResultLike< T, R >} - Furthest matches with objects
538
539
  */
539
- structuredFurthest<T = any>(query: string, data: T[], key: keyof T, n?: number, opt?: StructuredDataOptions): StructuredDataBatchResult<T, R> | T[];
540
+ structuredFurthest<T = any>(query: string, data: T[], key: keyof T, n?: number, opt?: StructuredDataOptions): StructuredResultLike<T, R>;
540
541
  /**
541
542
  * Performs a pairwise comparison between two arrays of structured objects
542
543
  * by extracting specific properties and returning results with original objects attached.
@@ -548,7 +549,7 @@ export declare class CmpStr<R = MetricRaw> {
548
549
  * @param {O[]} other - The other array of structured objects
549
550
  * @param {keyof O} otherKey - The property key to extract from other array
550
551
  * @param {StructuredDataOptions} [opt] - Optional lookup options
551
- * @returns {StructuredDataBatchResult<T, R>|T[]} - Pairwise results with original objects
552
+ * @returns {StructuredResultLike< T, R >} - Pairwise results with original objects
552
553
  */
553
- structuredPairs<T = any, O = any>(data: T[], key: keyof T, other: O[], otherKey: keyof O, opt?: StructuredDataOptions): StructuredDataBatchResult<T, R> | T[];
554
+ structuredPairs<T = any, O = any>(data: T[], key: keyof T, other: O[], otherKey: keyof O, opt?: StructuredDataOptions): StructuredResultLike<T, R>;
554
555
  }
@@ -19,7 +19,7 @@
19
19
  * @author Paul Köhler (komed3)
20
20
  * @license MIT
21
21
  */
22
- import type { CmpStrOptions, CmpStrProcessors, CmpStrResult, NormalizeFlags, PhoneticOptions, MetricRaw, MetricInput, MetricMode, MetricResult, MetricResultSingle, MetricResultBatch, StructuredDataBatchResult, StructuredDataOptions } from './utils/Types';
22
+ import type { BatchResultLike, CmpStrOptions, CmpStrProcessors, CmpStrResult, MetricInput, MetricMode, MetricRaw, MetricResult, NormalizeFlags, PhoneticOptions, ResultLike, StructuredDataOptions, StructuredResultLike } from './utils/Types';
23
23
  import { CmpStr } from './CmpStr';
24
24
  /**
25
25
  * The CmpStrAsync class provides a fully asynchronous API for string comparison,
@@ -29,9 +29,9 @@ import { CmpStr } from './CmpStr';
29
29
  */
30
30
  export declare class CmpStrAsync<R = MetricRaw> extends CmpStr<R> {
31
31
  /**
32
- * --------------------------------------------------------------------------------
32
+ * ================================================================================
33
33
  * Instanciate the CmpStrAsync class
34
- * --------------------------------------------------------------------------------
34
+ * ================================================================================
35
35
  *
36
36
  * Methods to create a new CmpStrAsync instance with the given options.
37
37
  * Using the static `create` method is recommended to ensure proper instantiation.
@@ -39,20 +39,20 @@ export declare class CmpStrAsync<R = MetricRaw> extends CmpStr<R> {
39
39
  /**
40
40
  * Creates a new CmpStrAsync instance with the given options.
41
41
  *
42
- * @param {string|CmpStrOptions} [opt] - Optional serialized or options object
43
- * @returns {CmpStrAsync<R>} - A new CmpStrAsync instance
42
+ * @param {string | CmpStrOptions} [opt] - Optional serialized or options object
43
+ * @returns {CmpStrAsync< R >} - A new CmpStrAsync instance
44
44
  */
45
45
  static create<R = MetricRaw>(opt?: string | CmpStrOptions): CmpStrAsync<R>;
46
46
  /**
47
47
  * Creates a new CmpStrAsync instance calliing the super constructor.
48
48
  *
49
- * @param {string|CmpStrOptions} [opt] - Optional serialized or options object
49
+ * @param {string | CmpStrOptions} [opt] - Optional serialized or options object
50
50
  */
51
51
  protected constructor(opt?: string | CmpStrOptions);
52
52
  /**
53
- * ---------------------------------------------------------------------------------
53
+ * ================================================================================-
54
54
  * Protected asynchronously utility methods for internal use
55
- * ---------------------------------------------------------------------------------
55
+ * ================================================================================-
56
56
  *
57
57
  * These methods provide asynchronous normalization, filtering, and metric
58
58
  * computation capabilities, allowing for non-blocking operations.
@@ -62,7 +62,7 @@ export declare class CmpStrAsync<R = MetricRaw> extends CmpStr<R> {
62
62
  *
63
63
  * @param {MetricInput} input - The input string or array
64
64
  * @param {NormalizeFlags} [flags] - Normalization flags
65
- * @returns {Promise<MetricInput>} - The normalized input
65
+ * @returns {Promise< MetricInput >} - The normalized input
66
66
  */
67
67
  protected normalizeAsync(input: MetricInput, flags?: NormalizeFlags): Promise<MetricInput>;
68
68
  /**
@@ -70,7 +70,7 @@ export declare class CmpStrAsync<R = MetricRaw> extends CmpStr<R> {
70
70
  *
71
71
  * @param {MetricInput} input - The input string or array
72
72
  * @param {string} [hook='input'] - The filter hook
73
- * @returns {Promise<MetricInput>} - The filtered string(s)
73
+ * @returns {Promise< MetricInput >} - The filtered string(s)
74
74
  */
75
75
  protected filterAsync(input: MetricInput, hook: string): Promise<MetricInput>;
76
76
  /**
@@ -78,7 +78,7 @@ export declare class CmpStrAsync<R = MetricRaw> extends CmpStr<R> {
78
78
  *
79
79
  * @param {MetricInput} [input] - The input string or array
80
80
  * @param {CmpStrOptions} [opt] - Optional options to use
81
- * @returns {Promise<MetricInput>} - The prepared input
81
+ * @returns {Promise< MetricInput >} - The prepared input
82
82
  */
83
83
  protected prepareAsync(input: MetricInput, opt?: CmpStrOptions): Promise<MetricInput>;
84
84
  /**
@@ -87,7 +87,7 @@ export declare class CmpStrAsync<R = MetricRaw> extends CmpStr<R> {
87
87
  *
88
88
  * @param {MetricInput} input - The input string or array
89
89
  * @param {{ algo: string, opt?: PhoneticOptions }} options - The phonetic algorithm and options
90
- * @returns {Promise<MetricInput>} - The phonetic index for the given input
90
+ * @returns {Promise< MetricInput >} - The phonetic index for the given input
91
91
  */
92
92
  protected indexAsync(input: MetricInput, { algo, opt }: {
93
93
  algo: string;
@@ -104,13 +104,13 @@ export declare class CmpStrAsync<R = MetricRaw> extends CmpStr<R> {
104
104
  * @param {MetricMode} [mode='single'] - The metric mode to use
105
105
  * @param {boolean} [raw=false] - Whether to return raw results
106
106
  * @param {boolean} [skip=false] - Whether to skip normalization and filtering
107
- * @returns {Promise<T>} - The computed metric result
107
+ * @returns {Promise< T >} - The computed metric result
108
108
  */
109
109
  protected computeAsync<T extends MetricResult<R> | CmpStrResult | CmpStrResult[]>(a: MetricInput, b: MetricInput, opt?: CmpStrOptions, mode?: MetricMode, raw?: boolean, skip?: boolean): Promise<T>;
110
110
  /**
111
- * ---------------------------------------------------------------------------------
111
+ * ================================================================================-
112
112
  * Public asynchronously core methods for string comparison
113
- * ---------------------------------------------------------------------------------
113
+ * ================================================================================-
114
114
  *
115
115
  * These methods provide the asynchronous core functionality for string comparison,
116
116
  * phonetic indexing and text search, allowing for non-blocking operations.
@@ -122,16 +122,16 @@ export declare class CmpStrAsync<R = MetricRaw> extends CmpStr<R> {
122
122
  * @param {string} a - The source string
123
123
  * @param {string} b - The target string
124
124
  * @param {CmpStrOptions} [opt] - Optional options
125
- * @returns {Promise<T>} - The metric result
125
+ * @returns {Promise< T >} - The metric result
126
126
  */
127
- testAsync<T extends CmpStrResult | MetricResultSingle<R> = any>(a: string, b: string, opt?: CmpStrOptions): Promise<T>;
127
+ testAsync<T extends ResultLike<R> = any>(a: string, b: string, opt?: CmpStrOptions): Promise<T>;
128
128
  /**
129
129
  * Asynchronously performs a single metric comparison returning the numeric score.
130
130
  *
131
131
  * @param {string} a - The source string
132
132
  * @param {string} b - The target string
133
133
  * @param {CmpStrOptions} [opt] - Optional options
134
- * @returns {Promise<number>} - The similarity score (0..1)
134
+ * @returns {Promise< number >} - The similarity score (0..1)
135
135
  */
136
136
  compareAsync(a: string, b: string, opt?: CmpStrOptions): Promise<number>;
137
137
  /**
@@ -142,34 +142,34 @@ export declare class CmpStrAsync<R = MetricRaw> extends CmpStr<R> {
142
142
  * @param {MetricInput} a - The source string or array of strings
143
143
  * @param {MetricInput} b - The target string or array of strings
144
144
  * @param {CmpStrOptions} [opt] - Optional options
145
- * @returns {Promise<T>} - The batch metric results
145
+ * @returns {Promise< T >} - The batch metric results
146
146
  */
147
- batchTestAsync<T extends CmpStrResult[] | MetricResultBatch<R> = any>(a: MetricInput, b: MetricInput, opt?: CmpStrOptions): Promise<T>;
147
+ batchTestAsync<T extends BatchResultLike<R> = any>(a: MetricInput, b: MetricInput, opt?: CmpStrOptions): Promise<T>;
148
148
  /**
149
149
  * Asynchronously performs a batch metric comparison and returns results sorted by score.
150
150
  *
151
151
  * @template T - The type of the metric result
152
152
  * @param {MetricInput} a - The source string or array of strings
153
153
  * @param {MetricInput} b - The target string or array of strings
154
- * @param {'desc'|'asc'} [dir='desc'] - Sort direction (desc, asc)
154
+ * @param {'desc' | 'asc'} [dir='desc'] - Sort direction (desc, asc)
155
155
  * @param {CmpStrOptions} [opt] - Optional options
156
- * @returns {Promise<T>} - The sorted batch results
156
+ * @returns {Promise< T >} - The sorted batch results
157
157
  */
158
- batchSortedAsync<T extends CmpStrResult[] | MetricResultBatch<R> = any>(a: MetricInput, b: MetricInput, dir?: 'desc' | 'asc', opt?: CmpStrOptions): Promise<T>;
158
+ batchSortedAsync<T extends BatchResultLike<R> = any>(a: MetricInput, b: MetricInput, dir?: 'desc' | 'asc', opt?: CmpStrOptions): Promise<T>;
159
159
  /**
160
160
  * Asynchronously performs a pairwise metric comparison between source and target
161
161
  * strings or array of strings.
162
162
  *
163
- * @template T - The type of the metric result
164
163
  * Input arrays needs of the same length to perform pairwise comparison,
165
164
  * otherwise the method will throw an error.
166
165
  *
166
+ * @template T - The type of the metric result
167
167
  * @param {MetricInput} a - The source string or array of strings
168
168
  * @param {MetricInput} b - The target string or array of strings
169
169
  * @param {CmpStrOptions} [opt] - Optional options
170
- * @returns {Promise<T>} - The pairwise metric results
170
+ * @returns {Promise< T >} - The pairwise metric results
171
171
  */
172
- pairsAsync<T extends CmpStrResult[] | MetricResultBatch<R> = any>(a: MetricInput, b: MetricInput, opt?: CmpStrOptions): Promise<T>;
172
+ pairsAsync<T extends BatchResultLike<R> = any>(a: MetricInput, b: MetricInput, opt?: CmpStrOptions): Promise<T>;
173
173
  /**
174
174
  * Asynchronously performs a batch comparison and returns only results above the threshold.
175
175
  *
@@ -178,9 +178,9 @@ export declare class CmpStrAsync<R = MetricRaw> extends CmpStr<R> {
178
178
  * @param {MetricInput} b - The target string or array of strings
179
179
  * @param {number} threshold - The similarity threshold (0..1)
180
180
  * @param {CmpStrOptions} [opt] - Optional options
181
- * @returns {Promise<T>} - The filtered batch results
181
+ * @returns {Promise< T >} - The filtered batch results
182
182
  */
183
- matchAsync<T extends CmpStrResult[] | MetricResultBatch<R> = any>(a: MetricInput, b: MetricInput, threshold: number, opt?: CmpStrOptions): Promise<T>;
183
+ matchAsync<T extends BatchResultLike<R> = any>(a: MetricInput, b: MetricInput, threshold: number, opt?: CmpStrOptions): Promise<T>;
184
184
  /**
185
185
  * Asynchronously returns the n closest matches from a batch comparison.
186
186
  *
@@ -189,9 +189,9 @@ export declare class CmpStrAsync<R = MetricRaw> extends CmpStr<R> {
189
189
  * @param {MetricInput} b - The target string or array of strings
190
190
  * @param {number} [n=1] - Number of closest matches
191
191
  * @param {CmpStrOptions} [opt] - Optional options
192
- * @returns {Promise<T>} - The closest matches
192
+ * @returns {Promise< T >} - The closest matches
193
193
  */
194
- closestAsync<T extends CmpStrResult[] | MetricResultBatch<R> = any>(a: MetricInput, b: MetricInput, n?: number, opt?: CmpStrOptions): Promise<T>;
194
+ closestAsync<T extends BatchResultLike<R> = any>(a: MetricInput, b: MetricInput, n?: number, opt?: CmpStrOptions): Promise<T>;
195
195
  /**
196
196
  * Asynchronously returns the n furthest matches from a batch comparison.
197
197
  *
@@ -202,7 +202,7 @@ export declare class CmpStrAsync<R = MetricRaw> extends CmpStr<R> {
202
202
  * @param {CmpStrOptions} [opt] - Optional options
203
203
  * @returns {Promise<T>} - The furthest matches
204
204
  */
205
- furthestAsync<T extends CmpStrResult[] | MetricResultBatch<R> = any>(a: MetricInput, b: MetricInput, n?: number, opt?: CmpStrOptions): Promise<T>;
205
+ furthestAsync<T extends BatchResultLike<R> = any>(a: MetricInput, b: MetricInput, n?: number, opt?: CmpStrOptions): Promise<T>;
206
206
  /**
207
207
  * Asynchronously performs a normalized and filtered substring search.
208
208
  *
@@ -210,7 +210,7 @@ export declare class CmpStrAsync<R = MetricRaw> extends CmpStr<R> {
210
210
  * @param {string[]} haystack - The array to search in
211
211
  * @param {NormalizeFlags} [flags] - Normalization flags
212
212
  * @param {CmpStrProcessors} [processors] - Pre-processors to apply
213
- * @returns {Promise<string[]>} - Array of matching entries
213
+ * @returns {Promise< string[] >} - Array of matching entries
214
214
  */
215
215
  searchAsync(needle: string, haystack: string[], flags?: NormalizeFlags, processors?: CmpStrProcessors): Promise<string[]>;
216
216
  /**
@@ -218,7 +218,7 @@ export declare class CmpStrAsync<R = MetricRaw> extends CmpStr<R> {
218
218
  *
219
219
  * @param {string[]} input - The input array
220
220
  * @param {CmpStrOptions} [opt] - Optional options
221
- * @returns {Promise<number[][]>} - The similarity matrix
221
+ * @returns {Promise< number[][] >} - The similarity matrix
222
222
  */
223
223
  matrixAsync(input: string[], opt?: CmpStrOptions): Promise<number[][]>;
224
224
  /**
@@ -232,9 +232,9 @@ export declare class CmpStrAsync<R = MetricRaw> extends CmpStr<R> {
232
232
  */
233
233
  phoneticIndexAsync(input: string, algo?: string, opt?: PhoneticOptions): Promise<string>;
234
234
  /**
235
- * ---------------------------------------------------------------------------------
235
+ * ================================================================================-
236
236
  * Public asynchronous methods for structured data comparison
237
- * ---------------------------------------------------------------------------------
237
+ * ================================================================================-
238
238
  *
239
239
  * These methods provide asynchronous interfaces for comparing arrays of
240
240
  * structured objects by extracting and comparing specific properties.
@@ -248,9 +248,9 @@ export declare class CmpStrAsync<R = MetricRaw> extends CmpStr<R> {
248
248
  * @param {T[]} data - The array of structured objects
249
249
  * @param {keyof T} key - The property key to extract for comparison
250
250
  * @param {StructuredDataOptions} [opt] - Optional lookup options
251
- * @returns {Promise<StructuredDataBatchResult<T, R>|T[]>} - Async batch results with original objects
251
+ * @returns {Promise< StructuredResultLike< T, R > >} - Async batch results with original objects
252
252
  */
253
- structuredLookupAsync<T = any>(query: string, data: T[], key: keyof T, opt?: StructuredDataOptions): Promise<StructuredDataBatchResult<T, R> | T[]>;
253
+ structuredLookupAsync<T = any>(query: string, data: T[], key: keyof T, opt?: StructuredDataOptions): Promise<StructuredResultLike<T, R>>;
254
254
  /**
255
255
  * Asynchronously performs a batch comparison and returns only results above
256
256
  * the threshold for structured data.
@@ -261,9 +261,9 @@ export declare class CmpStrAsync<R = MetricRaw> extends CmpStr<R> {
261
261
  * @param {keyof T} key - The property key to extract for comparison
262
262
  * @param {number} threshold - The similarity threshold (0..1)
263
263
  * @param {StructuredDataLookupOptions} [opt] - Optional lookup options
264
- * @returns {Promise<StructuredDataBatchResult<T, R>|T[]>} - Async filtered batch results
264
+ * @returns {Promise< StructuredResultLike< T, R > >} - Async filtered batch results
265
265
  */
266
- structuredMatchAsync<T = any>(query: string, data: T[], key: keyof T, threshold: number, opt?: StructuredDataOptions): Promise<StructuredDataBatchResult<T, R> | T[]>;
266
+ structuredMatchAsync<T = any>(query: string, data: T[], key: keyof T, threshold: number, opt?: StructuredDataOptions): Promise<StructuredResultLike<T, R>>;
267
267
  /**
268
268
  * Asynchronously returns the n closest matches from a batch comparison
269
269
  * of structured data.
@@ -274,9 +274,9 @@ export declare class CmpStrAsync<R = MetricRaw> extends CmpStr<R> {
274
274
  * @param {keyof T} key - The property key to extract for comparison
275
275
  * @param {number} [n=1] - Number of closest matches
276
276
  * @param {StructuredDataOptions} [opt] - Optional lookup options
277
- * @returns {Promise<StructuredDataBatchResult<T, R>|T[]>} - Async closest matches
277
+ * @returns {Promise< StructuredResultLike< T, R > >} - Async closest matches
278
278
  */
279
- structuredClosestAsync<T = any>(query: string, data: T[], key: keyof T, n?: number, opt?: StructuredDataOptions): Promise<StructuredDataBatchResult<T, R> | T[]>;
279
+ structuredClosestAsync<T = any>(query: string, data: T[], key: keyof T, n?: number, opt?: StructuredDataOptions): Promise<StructuredResultLike<T, R>>;
280
280
  /**
281
281
  * Asynchronously returns the n furthest matches from a batch comparison
282
282
  * of structured data.
@@ -287,9 +287,9 @@ export declare class CmpStrAsync<R = MetricRaw> extends CmpStr<R> {
287
287
  * @param {keyof T} key - The property key to extract for comparison
288
288
  * @param {number} [n=1] - Number of furthest matches
289
289
  * @param {StructuredDataOptions} [opt] - Optional lookup options
290
- * @returns {Promise<StructuredDataBatchResult<T, R>|T[]>} - Async furthest matches
290
+ * @returns {Promise< StructuredResultLike< T, R > >} - Async furthest matches
291
291
  */
292
- structuredFurthestAsync<T = any>(query: string, data: T[], key: keyof T, n?: number, opt?: StructuredDataOptions): Promise<StructuredDataBatchResult<T, R> | T[]>;
292
+ structuredFurthestAsync<T = any>(query: string, data: T[], key: keyof T, n?: number, opt?: StructuredDataOptions): Promise<StructuredResultLike<T, R>>;
293
293
  /**
294
294
  * Asynchronously performs a pairwise comparison between two arrays of structured objects
295
295
  * by extracting specific properties and returning results with original objects attached.
@@ -301,7 +301,7 @@ export declare class CmpStrAsync<R = MetricRaw> extends CmpStr<R> {
301
301
  * @param {T[]} other - The other array of structured objects
302
302
  * @param {keyof T} otherKey - The property key to extract from other array
303
303
  * @param {StructuredDataOptions} [opt] - Optional lookup options
304
- * @returns {Promise<StructuredDataBatchResult<T, R>|T[]>} - Async pairwise results with original objects
304
+ * @returns {Promise< StructuredResultLike< T, R > >} - Async pairwise results with original objects
305
305
  */
306
- structuredPairsAsync<T = any, O = any>(data: T[], key: keyof T, other: O[], otherKey: keyof O, opt?: StructuredDataOptions): Promise<StructuredDataBatchResult<T, R> | T[]>;
306
+ structuredPairsAsync<T = any, O = any>(data: T[], key: keyof T, other: O[], otherKey: keyof O, opt?: StructuredDataOptions): Promise<StructuredResultLike<T, R>>;
307
307
  }