@nimbus-cqrs/mongodb 2.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +85 -0
- package/README.md +26 -0
- package/esm/_dnt.shims.d.ts +2 -0
- package/esm/_dnt.shims.d.ts.map +1 -0
- package/esm/_dnt.shims.js +57 -0
- package/esm/deps/jsr.io/@std/fmt/1.0.10/colors.d.ts +700 -0
- package/esm/deps/jsr.io/@std/fmt/1.0.10/colors.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/fmt/1.0.10/colors.js +903 -0
- package/esm/deps/jsr.io/@std/text/1.0.18/_util.d.ts +3 -0
- package/esm/deps/jsr.io/@std/text/1.0.18/_util.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/text/1.0.18/_util.js +13 -0
- package/esm/deps/jsr.io/@std/text/1.0.18/closest_string.d.ts +42 -0
- package/esm/deps/jsr.io/@std/text/1.0.18/closest_string.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/text/1.0.18/closest_string.js +46 -0
- package/esm/deps/jsr.io/@std/text/1.0.18/compare_similarity.d.ts +47 -0
- package/esm/deps/jsr.io/@std/text/1.0.18/compare_similarity.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/text/1.0.18/compare_similarity.js +39 -0
- package/esm/deps/jsr.io/@std/text/1.0.18/levenshtein_distance.d.ts +23 -0
- package/esm/deps/jsr.io/@std/text/1.0.18/levenshtein_distance.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/text/1.0.18/levenshtein_distance.js +127 -0
- package/esm/deps/jsr.io/@std/text/1.0.18/mod.d.ts +26 -0
- package/esm/deps/jsr.io/@std/text/1.0.18/mod.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/text/1.0.18/mod.js +27 -0
- package/esm/deps/jsr.io/@std/text/1.0.18/to_camel_case.d.ts +16 -0
- package/esm/deps/jsr.io/@std/text/1.0.18/to_camel_case.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/text/1.0.18/to_camel_case.js +22 -0
- package/esm/deps/jsr.io/@std/text/1.0.18/to_kebab_case.d.ts +16 -0
- package/esm/deps/jsr.io/@std/text/1.0.18/to_kebab_case.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/text/1.0.18/to_kebab_case.js +21 -0
- package/esm/deps/jsr.io/@std/text/1.0.18/to_pascal_case.d.ts +16 -0
- package/esm/deps/jsr.io/@std/text/1.0.18/to_pascal_case.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/text/1.0.18/to_pascal_case.js +21 -0
- package/esm/deps/jsr.io/@std/text/1.0.18/to_snake_case.d.ts +16 -0
- package/esm/deps/jsr.io/@std/text/1.0.18/to_snake_case.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/text/1.0.18/to_snake_case.js +21 -0
- package/esm/deps/jsr.io/@std/text/1.0.18/word_similarity_sort.d.ts +42 -0
- package/esm/deps/jsr.io/@std/text/1.0.18/word_similarity_sort.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/text/1.0.18/word_similarity_sort.js +43 -0
- package/esm/deps/jsr.io/@std/ulid/1.0.0/_util.d.ts +14 -0
- package/esm/deps/jsr.io/@std/ulid/1.0.0/_util.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/ulid/1.0.0/_util.js +65 -0
- package/esm/deps/jsr.io/@std/ulid/1.0.0/decode_time.d.ts +20 -0
- package/esm/deps/jsr.io/@std/ulid/1.0.0/decode_time.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/ulid/1.0.0/decode_time.js +43 -0
- package/esm/deps/jsr.io/@std/ulid/1.0.0/mod.d.ts +44 -0
- package/esm/deps/jsr.io/@std/ulid/1.0.0/mod.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/ulid/1.0.0/mod.js +47 -0
- package/esm/deps/jsr.io/@std/ulid/1.0.0/monotonic_ulid.d.ts +44 -0
- package/esm/deps/jsr.io/@std/ulid/1.0.0/monotonic_ulid.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/ulid/1.0.0/monotonic_ulid.js +51 -0
- package/esm/deps/jsr.io/@std/ulid/1.0.0/ulid.d.ts +31 -0
- package/esm/deps/jsr.io/@std/ulid/1.0.0/ulid.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/ulid/1.0.0/ulid.js +37 -0
- package/esm/index.d.ts +21 -0
- package/esm/index.d.ts.map +1 -0
- package/esm/index.js +20 -0
- package/esm/lib/crud/aggregate.d.ts +31 -0
- package/esm/lib/crud/aggregate.d.ts.map +1 -0
- package/esm/lib/crud/aggregate.js +37 -0
- package/esm/lib/crud/bulkWrite.d.ts +25 -0
- package/esm/lib/crud/bulkWrite.d.ts.map +1 -0
- package/esm/lib/crud/bulkWrite.js +22 -0
- package/esm/lib/crud/countDocuments.d.ts +25 -0
- package/esm/lib/crud/countDocuments.d.ts.map +1 -0
- package/esm/lib/crud/countDocuments.js +22 -0
- package/esm/lib/crud/deleteMany.d.ts +25 -0
- package/esm/lib/crud/deleteMany.d.ts.map +1 -0
- package/esm/lib/crud/deleteMany.js +22 -0
- package/esm/lib/crud/deleteOne.d.ts +25 -0
- package/esm/lib/crud/deleteOne.d.ts.map +1 -0
- package/esm/lib/crud/deleteOne.js +22 -0
- package/esm/lib/crud/find.d.ts +39 -0
- package/esm/lib/crud/find.d.ts.map +1 -0
- package/esm/lib/crud/find.js +53 -0
- package/esm/lib/crud/findOne.d.ts +29 -0
- package/esm/lib/crud/findOne.d.ts.map +1 -0
- package/esm/lib/crud/findOne.js +38 -0
- package/esm/lib/crud/findOneAndDelete.d.ts +31 -0
- package/esm/lib/crud/findOneAndDelete.d.ts.map +1 -0
- package/esm/lib/crud/findOneAndDelete.js +44 -0
- package/esm/lib/crud/findOneAndReplace.d.ts +33 -0
- package/esm/lib/crud/findOneAndReplace.d.ts.map +1 -0
- package/esm/lib/crud/findOneAndReplace.js +45 -0
- package/esm/lib/crud/findOneAndUpdate.d.ts +33 -0
- package/esm/lib/crud/findOneAndUpdate.d.ts.map +1 -0
- package/esm/lib/crud/findOneAndUpdate.js +45 -0
- package/esm/lib/crud/insertMany.d.ts +25 -0
- package/esm/lib/crud/insertMany.d.ts.map +1 -0
- package/esm/lib/crud/insertMany.js +22 -0
- package/esm/lib/crud/insertOne.d.ts +25 -0
- package/esm/lib/crud/insertOne.d.ts.map +1 -0
- package/esm/lib/crud/insertOne.js +22 -0
- package/esm/lib/crud/replaceOne.d.ts +27 -0
- package/esm/lib/crud/replaceOne.d.ts.map +1 -0
- package/esm/lib/crud/replaceOne.js +23 -0
- package/esm/lib/crud/updateMany.d.ts +27 -0
- package/esm/lib/crud/updateMany.d.ts.map +1 -0
- package/esm/lib/crud/updateMany.js +23 -0
- package/esm/lib/crud/updateOne.d.ts +27 -0
- package/esm/lib/crud/updateOne.d.ts.map +1 -0
- package/esm/lib/crud/updateOne.js +23 -0
- package/esm/lib/deployCollection.d.ts +33 -0
- package/esm/lib/deployCollection.d.ts.map +1 -0
- package/esm/lib/deployCollection.js +125 -0
- package/esm/lib/handleMongoError.d.ts +10 -0
- package/esm/lib/handleMongoError.d.ts.map +1 -0
- package/esm/lib/handleMongoError.js +29 -0
- package/esm/lib/mongoConnectionManager.d.ts +107 -0
- package/esm/lib/mongoConnectionManager.d.ts.map +1 -0
- package/esm/lib/mongoConnectionManager.js +195 -0
- package/esm/lib/mongoJSON.d.ts +36 -0
- package/esm/lib/mongoJSON.d.ts.map +1 -0
- package/esm/lib/mongoJSON.js +96 -0
- package/esm/lib/repository.d.ts +145 -0
- package/esm/lib/repository.d.ts.map +1 -0
- package/esm/lib/repository.js +235 -0
- package/esm/lib/tracing.d.ts +17 -0
- package/esm/lib/tracing.d.ts.map +1 -0
- package/esm/lib/tracing.js +62 -0
- package/esm/package.json +3 -0
- package/package.json +35 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_util.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/text/1.0.18/_util.ts"],"names":[],"mappings":"AAaA,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,yBAEzC;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEnD"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// Copyright 2018-2026 the Deno authors. MIT license.
|
|
2
|
+
const CAPITALIZED_WORD_REGEXP = /\p{Lu}\p{Ll}+/u; // e.g. Apple
|
|
3
|
+
const ACRONYM_REGEXP = /\p{Lu}+(?=(\p{Lu}\p{Ll})|\P{L}|\b)/u; // e.g. ID, URL, handles an acronym followed by a capitalized word e.g. HTMLElement
|
|
4
|
+
const LOWERCASED_WORD_REGEXP = /(\p{Ll}+)/u; // e.g. apple
|
|
5
|
+
const ANY_LETTERS_REGEXP = /\p{L}+/u; // will match any sequence of letters, including in languages without a concept of upper/lower case
|
|
6
|
+
const DIGITS_REGEXP = /\p{N}+/u; // e.g. 123
|
|
7
|
+
const WORD_OR_NUMBER_REGEXP = new RegExp(`${CAPITALIZED_WORD_REGEXP.source}|${ACRONYM_REGEXP.source}|${LOWERCASED_WORD_REGEXP.source}|${ANY_LETTERS_REGEXP.source}|${DIGITS_REGEXP.source}`, "gu");
|
|
8
|
+
export function splitToWords(input) {
|
|
9
|
+
return input.match(WORD_OR_NUMBER_REGEXP) ?? [];
|
|
10
|
+
}
|
|
11
|
+
export function capitalizeWord(word) {
|
|
12
|
+
return word ? word[0].toUpperCase() + word.slice(1).toLowerCase() : word;
|
|
13
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/** Options for {@linkcode closestString}. */
|
|
2
|
+
export interface ClosestStringOptions {
|
|
3
|
+
/**
|
|
4
|
+
* Whether the distance should include case.
|
|
5
|
+
*
|
|
6
|
+
* @default {false}
|
|
7
|
+
*/
|
|
8
|
+
caseSensitive?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* A custom comparison function to use for comparing strings.
|
|
11
|
+
*
|
|
12
|
+
* @param a The first string for comparison.
|
|
13
|
+
* @param b The second string for comparison.
|
|
14
|
+
* @returns The distance between the two strings.
|
|
15
|
+
* @default {levenshteinDistance}
|
|
16
|
+
*/
|
|
17
|
+
compareFn?: (a: string, b: string) => number;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Finds the most similar string from an array of strings.
|
|
21
|
+
*
|
|
22
|
+
* By default, calculates the distance between words using the
|
|
23
|
+
* {@link https://en.wikipedia.org/wiki/Levenshtein_distance | Levenshtein distance}.
|
|
24
|
+
*
|
|
25
|
+
* @example Usage
|
|
26
|
+
* ```ts
|
|
27
|
+
* import { closestString } from "@std/text/closest-string";
|
|
28
|
+
* import { assertEquals } from "@std/assert";
|
|
29
|
+
*
|
|
30
|
+
* const possibleWords = ["length", "size", "blah", "help"];
|
|
31
|
+
* const suggestion = closestString("hep", possibleWords);
|
|
32
|
+
*
|
|
33
|
+
* assertEquals(suggestion, "help");
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
36
|
+
* @param givenWord The string to measure distance against
|
|
37
|
+
* @param possibleWords The string-array to pick the closest string from
|
|
38
|
+
* @param options The options for the comparison.
|
|
39
|
+
* @returns The closest string
|
|
40
|
+
*/
|
|
41
|
+
export declare function closestString(givenWord: string, possibleWords: ReadonlyArray<string>, options?: ClosestStringOptions): string;
|
|
42
|
+
//# sourceMappingURL=closest_string.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"closest_string.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/text/1.0.18/closest_string.ts"],"names":[],"mappings":"AAIA,6CAA6C;AAC7C,MAAM,WAAW,oBAAoB;IACnC;;;;OAIG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;;;;;OAOG;IACH,SAAS,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;CAC9C;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,aAAa,CAC3B,SAAS,EAAE,MAAM,EACjB,aAAa,EAAE,aAAa,CAAC,MAAM,CAAC,EACpC,OAAO,CAAC,EAAE,oBAAoB,GAC7B,MAAM,CAwBR"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// Copyright 2018-2026 the Deno authors. MIT license.
|
|
2
|
+
// This module is browser compatible.
|
|
3
|
+
import { levenshteinDistance } from "./levenshtein_distance.js";
|
|
4
|
+
/**
|
|
5
|
+
* Finds the most similar string from an array of strings.
|
|
6
|
+
*
|
|
7
|
+
* By default, calculates the distance between words using the
|
|
8
|
+
* {@link https://en.wikipedia.org/wiki/Levenshtein_distance | Levenshtein distance}.
|
|
9
|
+
*
|
|
10
|
+
* @example Usage
|
|
11
|
+
* ```ts
|
|
12
|
+
* import { closestString } from "@std/text/closest-string";
|
|
13
|
+
* import { assertEquals } from "@std/assert";
|
|
14
|
+
*
|
|
15
|
+
* const possibleWords = ["length", "size", "blah", "help"];
|
|
16
|
+
* const suggestion = closestString("hep", possibleWords);
|
|
17
|
+
*
|
|
18
|
+
* assertEquals(suggestion, "help");
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* @param givenWord The string to measure distance against
|
|
22
|
+
* @param possibleWords The string-array to pick the closest string from
|
|
23
|
+
* @param options The options for the comparison.
|
|
24
|
+
* @returns The closest string
|
|
25
|
+
*/
|
|
26
|
+
export function closestString(givenWord, possibleWords, options) {
|
|
27
|
+
if (possibleWords.length === 0) {
|
|
28
|
+
throw new TypeError("When using closestString(), the possibleWords array must contain at least one word");
|
|
29
|
+
}
|
|
30
|
+
const { caseSensitive, compareFn = levenshteinDistance } = { ...options };
|
|
31
|
+
if (!caseSensitive) {
|
|
32
|
+
givenWord = givenWord.toLowerCase();
|
|
33
|
+
}
|
|
34
|
+
let nearestWord = possibleWords[0];
|
|
35
|
+
let closestStringDistance = Infinity;
|
|
36
|
+
for (const each of possibleWords) {
|
|
37
|
+
const distance = caseSensitive
|
|
38
|
+
? compareFn(givenWord, each)
|
|
39
|
+
: compareFn(givenWord, each.toLowerCase());
|
|
40
|
+
if (distance < closestStringDistance) {
|
|
41
|
+
nearestWord = each;
|
|
42
|
+
closestStringDistance = distance;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return nearestWord;
|
|
46
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/** Options for {@linkcode compareSimilarity}. */
|
|
2
|
+
export interface CompareSimilarityOptions {
|
|
3
|
+
/**
|
|
4
|
+
* Whether the distance should include case.
|
|
5
|
+
*
|
|
6
|
+
* @default {false}
|
|
7
|
+
*/
|
|
8
|
+
caseSensitive?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* A custom comparison function to use for comparing strings.
|
|
11
|
+
*
|
|
12
|
+
* @param a The first string for comparison.
|
|
13
|
+
* @param b The second string for comparison.
|
|
14
|
+
* @returns The distance between the two strings.
|
|
15
|
+
* @default {levenshteinDistance}
|
|
16
|
+
*/
|
|
17
|
+
compareFn?: (a: string, b: string) => number;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Takes a string and generates a comparator function to determine which of two
|
|
21
|
+
* strings is more similar to the given one.
|
|
22
|
+
*
|
|
23
|
+
* By default, calculates the distance between words using the
|
|
24
|
+
* {@link https://en.wikipedia.org/wiki/Levenshtein_distance | Levenshtein distance}.
|
|
25
|
+
*
|
|
26
|
+
* @param givenWord The string to measure distance against.
|
|
27
|
+
* @param options Options for the sort.
|
|
28
|
+
* @returns The difference in distance. This will be a negative number if `a`
|
|
29
|
+
* is more similar to `givenWord` than `b`, a positive number if `b` is more
|
|
30
|
+
* similar, or `0` if they are equally similar.
|
|
31
|
+
*
|
|
32
|
+
* @example Usage
|
|
33
|
+
*
|
|
34
|
+
* Most-similar words will be at the start of the array.
|
|
35
|
+
*
|
|
36
|
+
* ```ts
|
|
37
|
+
* import { compareSimilarity } from "@std/text/compare-similarity";
|
|
38
|
+
* import { assertEquals } from "@std/assert";
|
|
39
|
+
*
|
|
40
|
+
* const words = ["hi", "hello", "help"];
|
|
41
|
+
* const sortedWords = words.toSorted(compareSimilarity("hep"));
|
|
42
|
+
*
|
|
43
|
+
* assertEquals(sortedWords, ["help", "hi", "hello"]);
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
export declare function compareSimilarity(givenWord: string, options?: CompareSimilarityOptions): (a: string, b: string) => number;
|
|
47
|
+
//# sourceMappingURL=compare_similarity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compare_similarity.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/text/1.0.18/compare_similarity.ts"],"names":[],"mappings":"AAIA,iDAAiD;AACjD,MAAM,WAAW,wBAAwB;IACvC;;;;OAIG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;;;;;OAOG;IACH,SAAS,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;CAC9C;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,wBAAwB,GACjC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,MAAM,CAUlC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// Copyright 2018-2026 the Deno authors. MIT license.
|
|
2
|
+
// This module is browser compatible.
|
|
3
|
+
import { levenshteinDistance } from "./levenshtein_distance.js";
|
|
4
|
+
/**
|
|
5
|
+
* Takes a string and generates a comparator function to determine which of two
|
|
6
|
+
* strings is more similar to the given one.
|
|
7
|
+
*
|
|
8
|
+
* By default, calculates the distance between words using the
|
|
9
|
+
* {@link https://en.wikipedia.org/wiki/Levenshtein_distance | Levenshtein distance}.
|
|
10
|
+
*
|
|
11
|
+
* @param givenWord The string to measure distance against.
|
|
12
|
+
* @param options Options for the sort.
|
|
13
|
+
* @returns The difference in distance. This will be a negative number if `a`
|
|
14
|
+
* is more similar to `givenWord` than `b`, a positive number if `b` is more
|
|
15
|
+
* similar, or `0` if they are equally similar.
|
|
16
|
+
*
|
|
17
|
+
* @example Usage
|
|
18
|
+
*
|
|
19
|
+
* Most-similar words will be at the start of the array.
|
|
20
|
+
*
|
|
21
|
+
* ```ts
|
|
22
|
+
* import { compareSimilarity } from "@std/text/compare-similarity";
|
|
23
|
+
* import { assertEquals } from "@std/assert";
|
|
24
|
+
*
|
|
25
|
+
* const words = ["hi", "hello", "help"];
|
|
26
|
+
* const sortedWords = words.toSorted(compareSimilarity("hep"));
|
|
27
|
+
*
|
|
28
|
+
* assertEquals(sortedWords, ["help", "hi", "hello"]);
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export function compareSimilarity(givenWord, options) {
|
|
32
|
+
const { compareFn = levenshteinDistance } = { ...options };
|
|
33
|
+
if (options?.caseSensitive) {
|
|
34
|
+
return (a, b) => compareFn(givenWord, a) - compareFn(givenWord, b);
|
|
35
|
+
}
|
|
36
|
+
givenWord = givenWord.toLowerCase();
|
|
37
|
+
return (a, b) => compareFn(givenWord, a.toLowerCase()) -
|
|
38
|
+
compareFn(givenWord, b.toLowerCase());
|
|
39
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Calculates the
|
|
3
|
+
* {@link https://en.wikipedia.org/wiki/Levenshtein_distance | Levenshtein distance}
|
|
4
|
+
* between two strings.
|
|
5
|
+
*
|
|
6
|
+
* > [!NOTE]
|
|
7
|
+
* > The complexity of this function is O(m * n), where m and n are the lengths
|
|
8
|
+
* > of the two strings. It's recommended to limit the length and validate input
|
|
9
|
+
* > if arbitrarily accepting input.
|
|
10
|
+
*
|
|
11
|
+
* @example Usage
|
|
12
|
+
* ```ts
|
|
13
|
+
* import { levenshteinDistance } from "@std/text/levenshtein-distance";
|
|
14
|
+
* import { assertEquals } from "@std/assert";
|
|
15
|
+
*
|
|
16
|
+
* assertEquals(levenshteinDistance("aa", "bb"), 2);
|
|
17
|
+
* ```
|
|
18
|
+
* @param str1 The first string.
|
|
19
|
+
* @param str2 The second string.
|
|
20
|
+
* @returns The Levenshtein distance between the two strings.
|
|
21
|
+
*/
|
|
22
|
+
export declare function levenshteinDistance(str1: string, str2: string): number;
|
|
23
|
+
//# sourceMappingURL=levenshtein_distance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"levenshtein_distance.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/text/1.0.18/levenshtein_distance.ts"],"names":[],"mappings":"AAmGA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAWtE"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
// Copyright 2018-2026 the Deno authors. MIT license.
|
|
2
|
+
// This module is browser compatible.
|
|
3
|
+
const { ceil } = Math;
|
|
4
|
+
// This implements Myers' bit-vector algorithm as described here:
|
|
5
|
+
// https://dl.acm.org/doi/pdf/10.1145/316542.316550
|
|
6
|
+
const peq = new Uint32Array(0x110000);
|
|
7
|
+
function myers32(t, p) {
|
|
8
|
+
const n = t.length;
|
|
9
|
+
const m = p.length;
|
|
10
|
+
for (let i = 0; i < m; i++) {
|
|
11
|
+
peq[p[i].codePointAt(0)] |= 1 << i;
|
|
12
|
+
}
|
|
13
|
+
const last = m - 1;
|
|
14
|
+
let pv = -1;
|
|
15
|
+
let mv = 0;
|
|
16
|
+
let score = m;
|
|
17
|
+
for (let j = 0; j < n; j++) {
|
|
18
|
+
const eq = peq[t[j].codePointAt(0)];
|
|
19
|
+
const xv = eq | mv;
|
|
20
|
+
const xh = (((eq & pv) + pv) ^ pv) | eq;
|
|
21
|
+
let ph = mv | ~(xh | pv);
|
|
22
|
+
let mh = pv & xh;
|
|
23
|
+
score += ((ph >>> last) & 1) - ((mh >>> last) & 1);
|
|
24
|
+
// Set the horizontal delta in the first row to +1
|
|
25
|
+
// because we are computing the distance between two full strings.
|
|
26
|
+
ph = (ph << 1) | 1;
|
|
27
|
+
mh = mh << 1;
|
|
28
|
+
pv = mh | ~(xv | ph);
|
|
29
|
+
mv = ph & xv;
|
|
30
|
+
}
|
|
31
|
+
for (let i = 0; i < m; i++) {
|
|
32
|
+
peq[p[i].codePointAt(0)] = 0;
|
|
33
|
+
}
|
|
34
|
+
return score;
|
|
35
|
+
}
|
|
36
|
+
function myersX(t, p) {
|
|
37
|
+
const n = t.length;
|
|
38
|
+
const m = p.length;
|
|
39
|
+
// Initialize the horizontal deltas to +1.
|
|
40
|
+
const h = new Int8Array(n).fill(1);
|
|
41
|
+
const bmax = ceil(m / 32) - 1;
|
|
42
|
+
// Process the blocks row by row so that we can use the fixed-size peq array.
|
|
43
|
+
for (let b = 0; b < bmax; b++) {
|
|
44
|
+
const start = b * 32;
|
|
45
|
+
const end = (b + 1) * 32;
|
|
46
|
+
for (let i = start; i < end; i++) {
|
|
47
|
+
peq[p[i].codePointAt(0)] |= 1 << i;
|
|
48
|
+
}
|
|
49
|
+
let pv = -1;
|
|
50
|
+
let mv = 0;
|
|
51
|
+
for (let j = 0; j < n; j++) {
|
|
52
|
+
const hin = h[j];
|
|
53
|
+
let eq = peq[t[j].codePointAt(0)];
|
|
54
|
+
const xv = eq | mv;
|
|
55
|
+
eq |= hin >>> 31;
|
|
56
|
+
const xh = (((eq & pv) + pv) ^ pv) | eq;
|
|
57
|
+
let ph = mv | ~(xh | pv);
|
|
58
|
+
let mh = pv & xh;
|
|
59
|
+
h[j] = (ph >>> 31) - (mh >>> 31);
|
|
60
|
+
ph = (ph << 1) | (-hin >>> 31);
|
|
61
|
+
mh = (mh << 1) | (hin >>> 31);
|
|
62
|
+
pv = mh | ~(xv | ph);
|
|
63
|
+
mv = ph & xv;
|
|
64
|
+
}
|
|
65
|
+
for (let i = start; i < end; i++) {
|
|
66
|
+
peq[p[i].codePointAt(0)] = 0;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
const start = bmax * 32;
|
|
70
|
+
for (let i = start; i < m; i++) {
|
|
71
|
+
peq[p[i].codePointAt(0)] |= 1 << i;
|
|
72
|
+
}
|
|
73
|
+
const last = m - 1;
|
|
74
|
+
let pv = -1;
|
|
75
|
+
let mv = 0;
|
|
76
|
+
let score = m;
|
|
77
|
+
for (let j = 0; j < n; j++) {
|
|
78
|
+
const hin = h[j];
|
|
79
|
+
let eq = peq[t[j].codePointAt(0)];
|
|
80
|
+
const xv = eq | mv;
|
|
81
|
+
eq |= hin >>> 31;
|
|
82
|
+
const xh = (((eq & pv) + pv) ^ pv) | eq;
|
|
83
|
+
let ph = mv | ~(xh | pv);
|
|
84
|
+
let mh = pv & xh;
|
|
85
|
+
score += ((ph >>> last) & 1) - ((mh >>> last) & 1);
|
|
86
|
+
ph = (ph << 1) | (-hin >>> 31);
|
|
87
|
+
mh = (mh << 1) | (hin >>> 31);
|
|
88
|
+
pv = mh | ~(xv | ph);
|
|
89
|
+
mv = ph & xv;
|
|
90
|
+
}
|
|
91
|
+
for (let i = start; i < m; i++) {
|
|
92
|
+
peq[p[i].codePointAt(0)] = 0;
|
|
93
|
+
}
|
|
94
|
+
return score;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Calculates the
|
|
98
|
+
* {@link https://en.wikipedia.org/wiki/Levenshtein_distance | Levenshtein distance}
|
|
99
|
+
* between two strings.
|
|
100
|
+
*
|
|
101
|
+
* > [!NOTE]
|
|
102
|
+
* > The complexity of this function is O(m * n), where m and n are the lengths
|
|
103
|
+
* > of the two strings. It's recommended to limit the length and validate input
|
|
104
|
+
* > if arbitrarily accepting input.
|
|
105
|
+
*
|
|
106
|
+
* @example Usage
|
|
107
|
+
* ```ts
|
|
108
|
+
* import { levenshteinDistance } from "@std/text/levenshtein-distance";
|
|
109
|
+
* import { assertEquals } from "@std/assert";
|
|
110
|
+
*
|
|
111
|
+
* assertEquals(levenshteinDistance("aa", "bb"), 2);
|
|
112
|
+
* ```
|
|
113
|
+
* @param str1 The first string.
|
|
114
|
+
* @param str2 The second string.
|
|
115
|
+
* @returns The Levenshtein distance between the two strings.
|
|
116
|
+
*/
|
|
117
|
+
export function levenshteinDistance(str1, str2) {
|
|
118
|
+
let t = [...str1];
|
|
119
|
+
let p = [...str2];
|
|
120
|
+
if (t.length < p.length) {
|
|
121
|
+
[p, t] = [t, p];
|
|
122
|
+
}
|
|
123
|
+
if (p.length === 0) {
|
|
124
|
+
return t.length;
|
|
125
|
+
}
|
|
126
|
+
return p.length <= 32 ? myers32(t, p) : myersX(t, p);
|
|
127
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility functions for working with text.
|
|
3
|
+
*
|
|
4
|
+
* ```ts
|
|
5
|
+
* import { toCamelCase, compareSimilarity } from "@std/text";
|
|
6
|
+
* import { assertEquals } from "@std/assert";
|
|
7
|
+
*
|
|
8
|
+
* assertEquals(toCamelCase("snake_case"), "snakeCase");
|
|
9
|
+
*
|
|
10
|
+
* const words = ["hi", "help", "hello"];
|
|
11
|
+
*
|
|
12
|
+
* // Words most similar to "hep" will be at the front
|
|
13
|
+
* assertEquals(words.sort(compareSimilarity("hep")), ["help", "hi", "hello"]);
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* @module
|
|
17
|
+
*/
|
|
18
|
+
export * from "./levenshtein_distance.js";
|
|
19
|
+
export * from "./closest_string.js";
|
|
20
|
+
export * from "./compare_similarity.js";
|
|
21
|
+
export * from "./word_similarity_sort.js";
|
|
22
|
+
export * from "./to_camel_case.js";
|
|
23
|
+
export * from "./to_kebab_case.js";
|
|
24
|
+
export * from "./to_pascal_case.js";
|
|
25
|
+
export * from "./to_snake_case.js";
|
|
26
|
+
//# sourceMappingURL=mod.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/text/1.0.18/mod.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;GAgBG;AAEH,cAAc,2BAA2B,CAAC;AAC1C,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// Copyright 2018-2026 the Deno authors. MIT license.
|
|
2
|
+
// This module is browser compatible.
|
|
3
|
+
/**
|
|
4
|
+
* Utility functions for working with text.
|
|
5
|
+
*
|
|
6
|
+
* ```ts
|
|
7
|
+
* import { toCamelCase, compareSimilarity } from "@std/text";
|
|
8
|
+
* import { assertEquals } from "@std/assert";
|
|
9
|
+
*
|
|
10
|
+
* assertEquals(toCamelCase("snake_case"), "snakeCase");
|
|
11
|
+
*
|
|
12
|
+
* const words = ["hi", "help", "hello"];
|
|
13
|
+
*
|
|
14
|
+
* // Words most similar to "hep" will be at the front
|
|
15
|
+
* assertEquals(words.sort(compareSimilarity("hep")), ["help", "hi", "hello"]);
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* @module
|
|
19
|
+
*/
|
|
20
|
+
export * from "./levenshtein_distance.js";
|
|
21
|
+
export * from "./closest_string.js";
|
|
22
|
+
export * from "./compare_similarity.js";
|
|
23
|
+
export * from "./word_similarity_sort.js";
|
|
24
|
+
export * from "./to_camel_case.js";
|
|
25
|
+
export * from "./to_kebab_case.js";
|
|
26
|
+
export * from "./to_pascal_case.js";
|
|
27
|
+
export * from "./to_snake_case.js";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts a string into camelCase.
|
|
3
|
+
*
|
|
4
|
+
* @example Usage
|
|
5
|
+
* ```ts
|
|
6
|
+
* import { toCamelCase } from "@std/text/to-camel-case";
|
|
7
|
+
* import { assertEquals } from "@std/assert";
|
|
8
|
+
*
|
|
9
|
+
* assertEquals(toCamelCase("deno is awesome"),"denoIsAwesome");
|
|
10
|
+
* ```
|
|
11
|
+
*
|
|
12
|
+
* @param input The string that is going to be converted into camelCase
|
|
13
|
+
* @returns The string as camelCase
|
|
14
|
+
*/
|
|
15
|
+
export declare function toCamelCase(input: string): string;
|
|
16
|
+
//# sourceMappingURL=to_camel_case.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"to_camel_case.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/text/1.0.18/to_camel_case.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;GAaG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAIjD"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// Copyright 2018-2026 the Deno authors. MIT license.
|
|
2
|
+
// This module is browser compatible.
|
|
3
|
+
import { capitalizeWord, splitToWords } from "./_util.js";
|
|
4
|
+
/**
|
|
5
|
+
* Converts a string into camelCase.
|
|
6
|
+
*
|
|
7
|
+
* @example Usage
|
|
8
|
+
* ```ts
|
|
9
|
+
* import { toCamelCase } from "@std/text/to-camel-case";
|
|
10
|
+
* import { assertEquals } from "@std/assert";
|
|
11
|
+
*
|
|
12
|
+
* assertEquals(toCamelCase("deno is awesome"),"denoIsAwesome");
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* @param input The string that is going to be converted into camelCase
|
|
16
|
+
* @returns The string as camelCase
|
|
17
|
+
*/
|
|
18
|
+
export function toCamelCase(input) {
|
|
19
|
+
input = input.trim();
|
|
20
|
+
const [first = "", ...rest] = splitToWords(input);
|
|
21
|
+
return [first.toLowerCase(), ...rest.map(capitalizeWord)].join("");
|
|
22
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts a string into kebab-case.
|
|
3
|
+
*
|
|
4
|
+
* @example Usage
|
|
5
|
+
* ```ts
|
|
6
|
+
* import { toKebabCase } from "@std/text/to-kebab-case";
|
|
7
|
+
* import { assertEquals } from "@std/assert";
|
|
8
|
+
*
|
|
9
|
+
* assertEquals(toKebabCase("deno is awesome"), "deno-is-awesome");
|
|
10
|
+
* ```
|
|
11
|
+
*
|
|
12
|
+
* @param input The string that is going to be converted into kebab-case
|
|
13
|
+
* @returns The string as kebab-case
|
|
14
|
+
*/
|
|
15
|
+
export declare function toKebabCase(input: string): string;
|
|
16
|
+
//# sourceMappingURL=to_kebab_case.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"to_kebab_case.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/text/1.0.18/to_kebab_case.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;GAaG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAGjD"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// Copyright 2018-2026 the Deno authors. MIT license.
|
|
2
|
+
// This module is browser compatible.
|
|
3
|
+
import { splitToWords } from "./_util.js";
|
|
4
|
+
/**
|
|
5
|
+
* Converts a string into kebab-case.
|
|
6
|
+
*
|
|
7
|
+
* @example Usage
|
|
8
|
+
* ```ts
|
|
9
|
+
* import { toKebabCase } from "@std/text/to-kebab-case";
|
|
10
|
+
* import { assertEquals } from "@std/assert";
|
|
11
|
+
*
|
|
12
|
+
* assertEquals(toKebabCase("deno is awesome"), "deno-is-awesome");
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* @param input The string that is going to be converted into kebab-case
|
|
16
|
+
* @returns The string as kebab-case
|
|
17
|
+
*/
|
|
18
|
+
export function toKebabCase(input) {
|
|
19
|
+
input = input.trim();
|
|
20
|
+
return splitToWords(input).join("-").toLowerCase();
|
|
21
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts a string into PascalCase.
|
|
3
|
+
*
|
|
4
|
+
* @example Usage
|
|
5
|
+
* ```ts
|
|
6
|
+
* import { toPascalCase } from "@std/text/to-pascal-case";
|
|
7
|
+
* import { assertEquals } from "@std/assert";
|
|
8
|
+
*
|
|
9
|
+
* assertEquals(toPascalCase("deno is awesome"), "DenoIsAwesome");
|
|
10
|
+
* ```
|
|
11
|
+
*
|
|
12
|
+
* @param input The string that is going to be converted into PascalCase
|
|
13
|
+
* @returns The string as PascalCase
|
|
14
|
+
*/
|
|
15
|
+
export declare function toPascalCase(input: string): string;
|
|
16
|
+
//# sourceMappingURL=to_pascal_case.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"to_pascal_case.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/text/1.0.18/to_pascal_case.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;GAaG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAGlD"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// Copyright 2018-2026 the Deno authors. MIT license.
|
|
2
|
+
// This module is browser compatible.
|
|
3
|
+
import { capitalizeWord, splitToWords } from "./_util.js";
|
|
4
|
+
/**
|
|
5
|
+
* Converts a string into PascalCase.
|
|
6
|
+
*
|
|
7
|
+
* @example Usage
|
|
8
|
+
* ```ts
|
|
9
|
+
* import { toPascalCase } from "@std/text/to-pascal-case";
|
|
10
|
+
* import { assertEquals } from "@std/assert";
|
|
11
|
+
*
|
|
12
|
+
* assertEquals(toPascalCase("deno is awesome"), "DenoIsAwesome");
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* @param input The string that is going to be converted into PascalCase
|
|
16
|
+
* @returns The string as PascalCase
|
|
17
|
+
*/
|
|
18
|
+
export function toPascalCase(input) {
|
|
19
|
+
input = input.trim();
|
|
20
|
+
return splitToWords(input).map(capitalizeWord).join("");
|
|
21
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts a string into snake_case.
|
|
3
|
+
*
|
|
4
|
+
* @example Usage
|
|
5
|
+
* ```ts
|
|
6
|
+
* import { toSnakeCase } from "@std/text/to-snake-case";
|
|
7
|
+
* import { assertEquals } from "@std/assert";
|
|
8
|
+
*
|
|
9
|
+
* assertEquals(toSnakeCase("deno is awesome"), "deno_is_awesome");
|
|
10
|
+
* ```
|
|
11
|
+
*
|
|
12
|
+
* @param input The string that is going to be converted into snake_case
|
|
13
|
+
* @returns The string as snake_case
|
|
14
|
+
*/
|
|
15
|
+
export declare function toSnakeCase(input: string): string;
|
|
16
|
+
//# sourceMappingURL=to_snake_case.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"to_snake_case.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/text/1.0.18/to_snake_case.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;GAaG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAGjD"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// Copyright 2018-2026 the Deno authors. MIT license.
|
|
2
|
+
// This module is browser compatible.
|
|
3
|
+
import { splitToWords } from "./_util.js";
|
|
4
|
+
/**
|
|
5
|
+
* Converts a string into snake_case.
|
|
6
|
+
*
|
|
7
|
+
* @example Usage
|
|
8
|
+
* ```ts
|
|
9
|
+
* import { toSnakeCase } from "@std/text/to-snake-case";
|
|
10
|
+
* import { assertEquals } from "@std/assert";
|
|
11
|
+
*
|
|
12
|
+
* assertEquals(toSnakeCase("deno is awesome"), "deno_is_awesome");
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* @param input The string that is going to be converted into snake_case
|
|
16
|
+
* @returns The string as snake_case
|
|
17
|
+
*/
|
|
18
|
+
export function toSnakeCase(input) {
|
|
19
|
+
input = input.trim();
|
|
20
|
+
return splitToWords(input).join("_").toLowerCase();
|
|
21
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { type CompareSimilarityOptions } from "./compare_similarity.js";
|
|
2
|
+
/** Options for {@linkcode wordSimilaritySort}. */
|
|
3
|
+
export interface WordSimilaritySortOptions extends CompareSimilarityOptions {
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Sorts a string-array by similarity to a given string.
|
|
7
|
+
*
|
|
8
|
+
* By default, calculates the distance between words using the
|
|
9
|
+
* {@link https://en.wikipedia.org/wiki/Levenshtein_distance | Levenshtein distance}.
|
|
10
|
+
*
|
|
11
|
+
* @example Basic usage
|
|
12
|
+
*
|
|
13
|
+
* ```ts
|
|
14
|
+
* import { wordSimilaritySort } from "@std/text/word-similarity-sort";
|
|
15
|
+
* import { assertEquals } from "@std/assert";
|
|
16
|
+
*
|
|
17
|
+
* const possibleWords = ["length", "size", "blah", "help"];
|
|
18
|
+
* const suggestions = wordSimilaritySort("hep", possibleWords);
|
|
19
|
+
*
|
|
20
|
+
* assertEquals(suggestions, ["help", "size", "blah", "length"]);
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* @example Case-sensitive sorting
|
|
24
|
+
*
|
|
25
|
+
* ```ts
|
|
26
|
+
* import { wordSimilaritySort } from "@std/text/word-similarity-sort";
|
|
27
|
+
* import { assertEquals } from "@std/assert";
|
|
28
|
+
*
|
|
29
|
+
* const possibleWords = ["length", "Size", "blah", "HELP"];
|
|
30
|
+
* const suggestions = wordSimilaritySort("hep", possibleWords, { caseSensitive: true });
|
|
31
|
+
*
|
|
32
|
+
* assertEquals(suggestions, ["Size", "blah", "HELP", "length"]);
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* @param givenWord The string to measure distance against.
|
|
36
|
+
* @param possibleWords The string-array that will be sorted. This array will
|
|
37
|
+
* not be mutated, but the sorted copy will be returned.
|
|
38
|
+
* @param options Options for the sort.
|
|
39
|
+
* @returns A sorted copy of `possibleWords`.
|
|
40
|
+
*/
|
|
41
|
+
export declare function wordSimilaritySort(givenWord: string, possibleWords: ReadonlyArray<string>, options?: WordSimilaritySortOptions): string[];
|
|
42
|
+
//# sourceMappingURL=word_similarity_sort.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"word_similarity_sort.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/text/1.0.18/word_similarity_sort.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,wBAAwB,EAC9B,MAAM,yBAAyB,CAAC;AAEjC,kDAAkD;AAClD,MAAM,WAAW,yBAA0B,SAAQ,wBAAwB;CAAG;AAE9E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,MAAM,EACjB,aAAa,EAAE,aAAa,CAAC,MAAM,CAAC,EACpC,OAAO,CAAC,EAAE,yBAAyB,GAClC,MAAM,EAAE,CAGV"}
|