Skip to content

Commit a8f646f

Browse files
committed
cchanges to fuzzball lite
1 parent 1086b80 commit a8f646f

File tree

4 files changed

+16
-4
lines changed

4 files changed

+16
-4
lines changed

jsdocs/fuzzball.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,7 @@ Return the top scoring items from an array (or assoc array) of choices
280280
| [options_p.sortBySimilarity] | <code>boolean</code> | sort tokens by similarity to each other before combining instead of alphabetically |
281281
| [options_p.wildcards] | <code>string</code> | characters that will be used as wildcards if provided |
282282
| [options_p.returnObjects] | <code>boolean</code> | return array of object instead of array of tuples; default false |
283+
| [options_p.abortController] | <code>Object</code> | track abortion |
283284
| [options_p.cancelToken] | <code>Object</code> | track cancellation |
284285
| [options_p.asyncLoopOffset] | <code>number</code> | number of rows to run in between every async loop iteration, default 256 |
285286
| callback | <code>function</code> | node style callback (err, arrayOfResults) |

lite/esm/fuzzball_lite.esm.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lite/fuzzball_lite.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
var processing = require('../lib/process.js')(clone_and_set_option_defaults, Array.isArray, QRatio, extract);
3030
var dedupe = processing.dedupe;
31-
31+
3232
/** Mostly follows after python fuzzywuzzy, https://github.com/seatgeek/fuzzywuzzy */
3333

3434

@@ -292,12 +292,18 @@
292292
* @param {boolean} [options_p.trySimple] - try simple/partial ratio as part of (parial_)token_set_ratio test suite
293293
* @param {string} [options_p.wildcards] - characters that will be used as wildcards if provided
294294
* @param {boolean} [options_p.returnObjects] - return array of object instead of array of tuples; default false
295+
* @param {Object} [options_p.abortController] - track abortion
295296
* @param {Object} [options_p.cancelToken] - track cancellation
296297
* @param {number} [options_p.asyncLoopOffset] - number of rows to run in between every async loop iteration, default 256
297298
* @param {function} callback - node style callback (err, arrayOfResults)
298299
*/
299300
var options = clone_and_set_option_defaults(options_p);
300301

302+
var abortController;
303+
if (typeof options_p.abortController === "object") {
304+
abortController = options_p.abortController;
305+
}
306+
301307
var cancelToken;
302308
if (typeof options_p.cancelToken === "object") {
303309
cancelToken = options_p.cancelToken;
@@ -428,6 +434,11 @@
428434
}
429435
}
430436

437+
if (abortController && abortController.signal.aborted === true) {
438+
callback(new Error("aborted"));
439+
return;
440+
}
441+
431442
if (cancelToken && cancelToken.canceled === true) {
432443
callback(new Error("canceled"));
433444
return;
@@ -476,7 +487,7 @@
476487
var sorted_2to1 = diff2to1.sort().join(" ");
477488
var combined_1to2 = sorted_sect + " " + sorted_1to2;
478489
var combined_2to1 = sorted_sect + " " + sorted_2to1;
479-
490+
480491
sorted_sect = sorted_sect.trim();
481492
combined_1to2 = combined_1to2.trim();
482493
combined_2to1 = combined_2to1.trim();

lite/fuzzball_lite.umd.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)