@powerlines/plugin-automd 0.1.341 → 0.1.342

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 (113) hide show
  1. package/README.md +14 -16
  2. package/dist/_virtual/{rolldown_runtime.cjs → _rolldown/runtime.cjs} +1 -3
  3. package/dist/_virtual/_rolldown/runtime.mjs +3 -0
  4. package/dist/index.cjs +26 -27
  5. package/dist/index.d.cts +0 -1
  6. package/dist/index.d.cts.map +1 -1
  7. package/dist/index.d.mts +0 -1
  8. package/dist/index.d.mts.map +1 -1
  9. package/dist/index.mjs +5 -6
  10. package/dist/index.mjs.map +1 -1
  11. package/dist/types/plugin.d.cts.map +1 -1
  12. package/dist/types/plugin.d.mts +1 -1
  13. package/dist/types/plugin.d.mts.map +1 -1
  14. package/dist/types/toc.d.cts.map +1 -1
  15. package/dist/types/toc.d.mts.map +1 -1
  16. package/package.json +20 -18
  17. package/dist/_virtual/rolldown_runtime.mjs +0 -32
  18. package/dist/node_modules/.pnpm/@jridgewell_sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.cjs +0 -78
  19. package/dist/node_modules/.pnpm/@jridgewell_sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs +0 -78
  20. package/dist/node_modules/.pnpm/@jridgewell_sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs.map +0 -1
  21. package/dist/node_modules/.pnpm/acorn@8.16.0/node_modules/acorn/dist/acorn.cjs +0 -5089
  22. package/dist/node_modules/.pnpm/acorn@8.16.0/node_modules/acorn/dist/acorn.mjs +0 -5089
  23. package/dist/node_modules/.pnpm/acorn@8.16.0/node_modules/acorn/dist/acorn.mjs.map +0 -1
  24. package/dist/node_modules/.pnpm/automd@0.4.3_patch_hash_5b5d5334735dce5e1ae79d8924a5aa49e4139453056613d618786b961793a42b_magicast@0.5.2/node_modules/automd/dist/index.cjs +0 -654
  25. package/dist/node_modules/.pnpm/automd@0.4.3_patch_hash_5b5d5334735dce5e1ae79d8924a5aa49e4139453056613d618786b961793a42b_magicast@0.5.2/node_modules/automd/dist/index.mjs +0 -652
  26. package/dist/node_modules/.pnpm/automd@0.4.3_patch_hash_5b5d5334735dce5e1ae79d8924a5aa49e4139453056613d618786b961793a42b_magicast@0.5.2/node_modules/automd/dist/index.mjs.map +0 -1
  27. package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/_format.cjs +0 -23
  28. package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/_format.mjs +0 -23
  29. package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/_format.mjs.map +0 -1
  30. package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/json.cjs +0 -10
  31. package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/json.mjs +0 -11
  32. package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/json.mjs.map +0 -1
  33. package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/libs/jsonc-parser.cjs +0 -388
  34. package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/libs/jsonc-parser.mjs +0 -388
  35. package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/libs/jsonc-parser.mjs.map +0 -1
  36. package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/jsonc.cjs +0 -11
  37. package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/jsonc.mjs +0 -12
  38. package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/jsonc.mjs.map +0 -1
  39. package/dist/node_modules/.pnpm/destr@2.0.5/node_modules/destr/dist/index.cjs +0 -46
  40. package/dist/node_modules/.pnpm/destr@2.0.5/node_modules/destr/dist/index.mjs +0 -46
  41. package/dist/node_modules/.pnpm/destr@2.0.5/node_modules/destr/dist/index.mjs.map +0 -1
  42. package/dist/node_modules/.pnpm/didyoumean2@7.0.4/node_modules/didyoumean2/dist/index.cjs +0 -204
  43. package/dist/node_modules/.pnpm/didyoumean2@7.0.4/node_modules/didyoumean2/dist/index.mjs +0 -203
  44. package/dist/node_modules/.pnpm/didyoumean2@7.0.4/node_modules/didyoumean2/dist/index.mjs.map +0 -1
  45. package/dist/node_modules/.pnpm/exsolve@1.0.8/node_modules/exsolve/dist/index.cjs +0 -1013
  46. package/dist/node_modules/.pnpm/exsolve@1.0.8/node_modules/exsolve/dist/index.mjs +0 -1008
  47. package/dist/node_modules/.pnpm/exsolve@1.0.8/node_modules/exsolve/dist/index.mjs.map +0 -1
  48. package/dist/node_modules/.pnpm/fastest-levenshtein@1.0.16/node_modules/fastest-levenshtein/mod.cjs +0 -128
  49. package/dist/node_modules/.pnpm/fastest-levenshtein@1.0.16/node_modules/fastest-levenshtein/mod.mjs +0 -124
  50. package/dist/node_modules/.pnpm/fastest-levenshtein@1.0.16/node_modules/fastest-levenshtein/mod.mjs.map +0 -1
  51. package/dist/node_modules/.pnpm/jiti@2.4.2/node_modules/jiti/dist/babel.cjs +0 -41464
  52. package/dist/node_modules/.pnpm/jiti@2.4.2/node_modules/jiti/dist/babel.mjs +0 -41462
  53. package/dist/node_modules/.pnpm/jiti@2.4.2/node_modules/jiti/dist/babel.mjs.map +0 -1
  54. package/dist/node_modules/.pnpm/jiti@2.4.2/node_modules/jiti/dist/jiti.cjs +0 -4387
  55. package/dist/node_modules/.pnpm/jiti@2.4.2/node_modules/jiti/dist/jiti.mjs +0 -4385
  56. package/dist/node_modules/.pnpm/jiti@2.4.2/node_modules/jiti/dist/jiti.mjs.map +0 -1
  57. package/dist/node_modules/.pnpm/jiti@2.4.2/node_modules/jiti/lib/jiti.cjs +0 -26
  58. package/dist/node_modules/.pnpm/jiti@2.4.2/node_modules/jiti/lib/jiti.mjs +0 -27
  59. package/dist/node_modules/.pnpm/jiti@2.4.2/node_modules/jiti/lib/jiti.mjs.map +0 -1
  60. package/dist/node_modules/.pnpm/lodash.deburr@4.1.0/node_modules/lodash.deburr/index.cjs +0 -370
  61. package/dist/node_modules/.pnpm/lodash.deburr@4.1.0/node_modules/lodash.deburr/index.mjs +0 -368
  62. package/dist/node_modules/.pnpm/lodash.deburr@4.1.0/node_modules/lodash.deburr/index.mjs.map +0 -1
  63. package/dist/node_modules/.pnpm/magic-string@0.30.21/node_modules/magic-string/dist/magic-string.es.cjs +0 -939
  64. package/dist/node_modules/.pnpm/magic-string@0.30.21/node_modules/magic-string/dist/magic-string.es.mjs +0 -940
  65. package/dist/node_modules/.pnpm/magic-string@0.30.21/node_modules/magic-string/dist/magic-string.es.mjs.map +0 -1
  66. package/dist/node_modules/.pnpm/mdbox@0.1.1/node_modules/mdbox/dist/index.cjs +0 -67
  67. package/dist/node_modules/.pnpm/mdbox@0.1.1/node_modules/mdbox/dist/index.mjs +0 -65
  68. package/dist/node_modules/.pnpm/mdbox@0.1.1/node_modules/mdbox/dist/index.mjs.map +0 -1
  69. package/dist/node_modules/.pnpm/mlly@1.8.1/node_modules/mlly/dist/index.cjs +0 -1350
  70. package/dist/node_modules/.pnpm/mlly@1.8.1/node_modules/mlly/dist/index.mjs +0 -1343
  71. package/dist/node_modules/.pnpm/mlly@1.8.1/node_modules/mlly/dist/index.mjs.map +0 -1
  72. package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/chunks/multipart-parser.cjs +0 -179
  73. package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/chunks/multipart-parser.mjs +0 -178
  74. package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/chunks/multipart-parser.mjs.map +0 -1
  75. package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/index.cjs +0 -20
  76. package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/index.mjs +0 -17
  77. package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/index.mjs.map +0 -1
  78. package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/node.cjs +0 -3975
  79. package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/node.mjs +0 -3962
  80. package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/node.mjs.map +0 -1
  81. package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/shared/node-fetch-native.DfbY2q-x.cjs +0 -16
  82. package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/shared/node-fetch-native.DfbY2q-x.mjs +0 -15
  83. package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/shared/node-fetch-native.DfbY2q-x.mjs.map +0 -1
  84. package/dist/node_modules/.pnpm/ofetch@1.5.1/node_modules/ofetch/dist/node.cjs +0 -36
  85. package/dist/node_modules/.pnpm/ofetch@1.5.1/node_modules/ofetch/dist/node.mjs +0 -34
  86. package/dist/node_modules/.pnpm/ofetch@1.5.1/node_modules/ofetch/dist/node.mjs.map +0 -1
  87. package/dist/node_modules/.pnpm/ofetch@1.5.1/node_modules/ofetch/dist/shared/ofetch.CWycOUEr.cjs +0 -227
  88. package/dist/node_modules/.pnpm/ofetch@1.5.1/node_modules/ofetch/dist/shared/ofetch.CWycOUEr.mjs +0 -226
  89. package/dist/node_modules/.pnpm/ofetch@1.5.1/node_modules/ofetch/dist/shared/ofetch.CWycOUEr.mjs.map +0 -1
  90. package/dist/node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.cjs +0 -139
  91. package/dist/node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs +0 -134
  92. package/dist/node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs.map +0 -1
  93. package/dist/node_modules/.pnpm/pkg-types@2.3.0/node_modules/pkg-types/dist/index.cjs +0 -78
  94. package/dist/node_modules/.pnpm/pkg-types@2.3.0/node_modules/pkg-types/dist/index.mjs +0 -78
  95. package/dist/node_modules/.pnpm/pkg-types@2.3.0/node_modules/pkg-types/dist/index.mjs.map +0 -1
  96. package/dist/node_modules/.pnpm/scule@1.3.0/node_modules/scule/dist/index.cjs +0 -72
  97. package/dist/node_modules/.pnpm/scule@1.3.0/node_modules/scule/dist/index.mjs +0 -70
  98. package/dist/node_modules/.pnpm/scule@1.3.0/node_modules/scule/dist/index.mjs.map +0 -1
  99. package/dist/node_modules/.pnpm/ufo@1.6.3/node_modules/ufo/dist/index.cjs +0 -181
  100. package/dist/node_modules/.pnpm/ufo@1.6.3/node_modules/ufo/dist/index.mjs +0 -179
  101. package/dist/node_modules/.pnpm/ufo@1.6.3/node_modules/ufo/dist/index.mjs.map +0 -1
  102. package/dist/node_modules/.pnpm/untyped@2.0.0/node_modules/untyped/dist/loader/babel.cjs +0 -12337
  103. package/dist/node_modules/.pnpm/untyped@2.0.0/node_modules/untyped/dist/loader/babel.mjs +0 -12338
  104. package/dist/node_modules/.pnpm/untyped@2.0.0/node_modules/untyped/dist/loader/babel.mjs.map +0 -1
  105. package/dist/node_modules/.pnpm/untyped@2.0.0/node_modules/untyped/dist/loader/loader.cjs +0 -19
  106. package/dist/node_modules/.pnpm/untyped@2.0.0/node_modules/untyped/dist/loader/loader.mjs +0 -19
  107. package/dist/node_modules/.pnpm/untyped@2.0.0/node_modules/untyped/dist/loader/loader.mjs.map +0 -1
  108. package/dist/node_modules/.pnpm/untyped@2.0.0/node_modules/untyped/dist/shared/untyped.BTwOq8Jl.cjs +0 -71
  109. package/dist/node_modules/.pnpm/untyped@2.0.0/node_modules/untyped/dist/shared/untyped.BTwOq8Jl.mjs +0 -72
  110. package/dist/node_modules/.pnpm/untyped@2.0.0/node_modules/untyped/dist/shared/untyped.BTwOq8Jl.mjs.map +0 -1
  111. package/dist/node_modules/.pnpm/untyped@2.0.0/node_modules/untyped/dist/shared/untyped.Br_uXjZG.cjs +0 -110
  112. package/dist/node_modules/.pnpm/untyped@2.0.0/node_modules/untyped/dist/shared/untyped.Br_uXjZG.mjs +0 -101
  113. package/dist/node_modules/.pnpm/untyped@2.0.0/node_modules/untyped/dist/shared/untyped.Br_uXjZG.mjs.map +0 -1
@@ -1,204 +0,0 @@
1
- const require_rolldown_runtime = require('../../../../../../_virtual/rolldown_runtime.cjs');
2
- const require_mod = require('../../../../fastest-levenshtein@1.0.16/node_modules/fastest-levenshtein/mod.cjs');
3
- const require_index = require('../../../../lodash.deburr@4.1.0/node_modules/lodash.deburr/index.cjs');
4
-
5
- //#region ../../node_modules/.pnpm/didyoumean2@7.0.4/node_modules/didyoumean2/dist/index.mjs
6
- var import_fastest_levenshtein = require_mod.default;
7
- var import_lodash = /* @__PURE__ */ require_rolldown_runtime.__toESM(require_index.default, 1);
8
- let ReturnTypeEnums = /* @__PURE__ */ function(ReturnTypeEnums$1) {
9
- ReturnTypeEnums$1["ALL_CLOSEST_MATCHES"] = "all-closest-matches";
10
- ReturnTypeEnums$1["ALL_MATCHES"] = "all-matches";
11
- ReturnTypeEnums$1["ALL_SORTED_MATCHES"] = "all-sorted-matches";
12
- ReturnTypeEnums$1["FIRST_CLOSEST_MATCH"] = "first-closest-match";
13
- ReturnTypeEnums$1["FIRST_MATCH"] = "first-match";
14
- return ReturnTypeEnums$1;
15
- }({});
16
- let ThresholdTypeEnums = /* @__PURE__ */ function(ThresholdTypeEnums$1) {
17
- ThresholdTypeEnums$1["EDIT_DISTANCE"] = "edit-distance";
18
- ThresholdTypeEnums$1["SIMILARITY"] = "similarity";
19
- return ThresholdTypeEnums$1;
20
- }({});
21
- const fillDefaultOptions = (options) => {
22
- const optionsWithDefaultValues = {
23
- caseSensitive: false,
24
- deburr: true,
25
- matchPath: [],
26
- returnType: ReturnTypeEnums.FIRST_CLOSEST_MATCH,
27
- thresholdType: ThresholdTypeEnums.SIMILARITY,
28
- trimSpaces: true,
29
- ...options
30
- };
31
- if (!Object.values(ReturnTypeEnums).includes(optionsWithDefaultValues.returnType)) throw new TypeError("unknown returnType");
32
- if (!Object.values(ThresholdTypeEnums).includes(optionsWithDefaultValues.thresholdType)) throw new TypeError("unknown thresholdType");
33
- switch (optionsWithDefaultValues.thresholdType) {
34
- case ThresholdTypeEnums.EDIT_DISTANCE: return {
35
- threshold: 20,
36
- ...optionsWithDefaultValues
37
- };
38
- case ThresholdTypeEnums.SIMILARITY: return {
39
- threshold: .4,
40
- ...optionsWithDefaultValues
41
- };
42
- }
43
- };
44
- /**
45
- * Using edit distance between `a` and `b` to calculate similarity
46
- *
47
- * @param {string} a - `input`
48
- * @param {string} b - String from `matchList`
49
- * @returns {number} similarity between `a` and `b`
50
- */
51
- const getSimilarity = (a, b) => {
52
- if (!a || !b) return 0;
53
- if (a === b) return 1;
54
- const editDistance = (0, import_fastest_levenshtein.distance)(a, b);
55
- const longestLength = Math.max(a.length, b.length);
56
- return (longestLength - editDistance) / longestLength;
57
- };
58
- /**
59
- * Normalize a string
60
- *
61
- * @param {string} str - any string
62
- * @param {object} options - options that allows you to modify the behavior
63
- * @returns {string} - normalized string
64
- */
65
- const normalizeString = (str, options) => {
66
- let s = str;
67
- if (options.trimSpaces) s = s.trim().replaceAll(/\s+/gu, " ");
68
- if (options.deburr) s = (0, import_lodash.default)(s);
69
- if (!options.caseSensitive) s = s.toLowerCase();
70
- return s;
71
- };
72
- const getMatchItemStr = (matchItem, matchPath) => {
73
- const matchItemStr = matchPath.length > 0 ? matchPath.reduce((acc, prop) => {
74
- return acc?.[prop];
75
- }, matchItem) : matchItem;
76
- if (typeof matchItemStr !== "string") return "";
77
- return matchItemStr;
78
- };
79
- /**
80
- * Process matchItem according to options
81
- *
82
- * @param {object | string} matchItem - Item for matching with `input`
83
- * @param {object} options - options that allows you to modify the behavior
84
- * @returns {string} - processed matchItem
85
- */
86
- const matchItemProcessor = (matchItem, options) => {
87
- const { matchPath } = options;
88
- return normalizeString(getMatchItemStr(matchItem, matchPath), options);
89
- };
90
- /**
91
- * Generate result
92
- *
93
- * @param {object[] | string[]} matchList - List for matching with `input`
94
- * @param {number[]} matchedIndexes - indexes of matchList that need to be returned as result
95
- * @param {ReturnTypeEnums} returnType - how the result will response to user
96
- * @returns {Array | null | object | string} - matched result(s), return object if `match` is `{Object[]}`
97
- */
98
- const resultProcessor = (matchList, matchedIndexes, returnType) => {
99
- switch (returnType) {
100
- case ReturnTypeEnums.ALL_CLOSEST_MATCHES:
101
- case ReturnTypeEnums.ALL_MATCHES:
102
- case ReturnTypeEnums.ALL_SORTED_MATCHES: return matchedIndexes.map((matchedIndex) => matchList[matchedIndex]);
103
- case ReturnTypeEnums.FIRST_CLOSEST_MATCH:
104
- case ReturnTypeEnums.FIRST_MATCH: {
105
- const matchedIndex = matchedIndexes[0];
106
- if (matchedIndex === void 0) return null;
107
- return matchList[matchedIndex];
108
- }
109
- }
110
- };
111
- /**
112
- * Main function for didyoumean2
113
- *
114
- * @param {string} input - string that you are not sure and want to match with `matchList`
115
- * @param {object[] | string[]} matchList - List for matching with `input`
116
- * @param {null | object | undefined} options - options that allows you to modify the behavior
117
- * @returns {Array | null | object | string} - matched result(s), return object if `match` is `{Object[]}`
118
- */
119
- function didYouMean(input, matchList, options) {
120
- const optionsWithDefaults = fillDefaultOptions(options);
121
- const { returnType, threshold, thresholdType } = optionsWithDefaults;
122
- const normalizedInput = normalizeString(input, optionsWithDefaults);
123
- let checkIfMatched;
124
- let scoreProcessor;
125
- switch (thresholdType) {
126
- case ThresholdTypeEnums.EDIT_DISTANCE:
127
- checkIfMatched = (score) => score <= threshold;
128
- scoreProcessor = (matchItem) => (0, import_fastest_levenshtein.distance)(normalizedInput, matchItemProcessor(matchItem, optionsWithDefaults));
129
- break;
130
- case ThresholdTypeEnums.SIMILARITY:
131
- checkIfMatched = (score) => score >= threshold;
132
- scoreProcessor = (matchItem) => getSimilarity(normalizedInput, matchItemProcessor(matchItem, optionsWithDefaults));
133
- break;
134
- }
135
- const matchedIndexes = [];
136
- switch (returnType) {
137
- case ReturnTypeEnums.ALL_CLOSEST_MATCHES:
138
- case ReturnTypeEnums.FIRST_CLOSEST_MATCH: {
139
- const scores = [];
140
- let marginValue;
141
- switch (thresholdType) {
142
- case ThresholdTypeEnums.EDIT_DISTANCE:
143
- marginValue = Number.POSITIVE_INFINITY;
144
- for (const matchItem of matchList) {
145
- const score = scoreProcessor(matchItem);
146
- if (marginValue > score) marginValue = score;
147
- scores.push(score);
148
- }
149
- break;
150
- case ThresholdTypeEnums.SIMILARITY:
151
- marginValue = 0;
152
- for (const matchItem of matchList) {
153
- const score = scoreProcessor(matchItem);
154
- if (marginValue < score) marginValue = score;
155
- scores.push(score);
156
- }
157
- break;
158
- }
159
- for (const [i, score] of scores.entries()) if (checkIfMatched(score) && score === marginValue) matchedIndexes.push(i);
160
- break;
161
- }
162
- case ReturnTypeEnums.ALL_MATCHES:
163
- for (const [i, matchItem] of matchList.entries()) {
164
- const score = scoreProcessor(matchItem);
165
- if (checkIfMatched(score)) matchedIndexes.push(i);
166
- }
167
- break;
168
- case ReturnTypeEnums.ALL_SORTED_MATCHES: {
169
- const unsortedResults = [];
170
- for (const [i, matchItem] of matchList.entries()) {
171
- const score = scoreProcessor(matchItem);
172
- if (checkIfMatched(score)) unsortedResults.push({
173
- score,
174
- index: i
175
- });
176
- }
177
- switch (thresholdType) {
178
- case ThresholdTypeEnums.EDIT_DISTANCE:
179
- unsortedResults.sort((a, b) => a.score - b.score);
180
- break;
181
- case ThresholdTypeEnums.SIMILARITY:
182
- unsortedResults.sort((a, b) => b.score - a.score);
183
- break;
184
- }
185
- for (const unsortedResult of unsortedResults) matchedIndexes.push(unsortedResult.index);
186
- break;
187
- }
188
- case ReturnTypeEnums.FIRST_MATCH:
189
- for (const [i, matchItem] of matchList.entries()) {
190
- const score = scoreProcessor(matchItem);
191
- if (checkIfMatched(score)) {
192
- matchedIndexes.push(i);
193
- break;
194
- }
195
- }
196
- break;
197
- }
198
- return resultProcessor(matchList, matchedIndexes, returnType);
199
- }
200
-
201
- //#endregion
202
- exports.ReturnTypeEnums = ReturnTypeEnums;
203
- exports.ThresholdTypeEnums = ThresholdTypeEnums;
204
- exports.default = didYouMean;
@@ -1,203 +0,0 @@
1
- import { __toESM } from "../../../../../../_virtual/rolldown_runtime.mjs";
2
- import { require_fastest_levenshtein } from "../../../../fastest-levenshtein@1.0.16/node_modules/fastest-levenshtein/mod.mjs";
3
- import { require_lodash } from "../../../../lodash.deburr@4.1.0/node_modules/lodash.deburr/index.mjs";
4
-
5
- //#region ../../node_modules/.pnpm/didyoumean2@7.0.4/node_modules/didyoumean2/dist/index.mjs
6
- var import_fastest_levenshtein = require_fastest_levenshtein();
7
- var import_lodash = /* @__PURE__ */ __toESM(require_lodash(), 1);
8
- let ReturnTypeEnums = /* @__PURE__ */ function(ReturnTypeEnums$1) {
9
- ReturnTypeEnums$1["ALL_CLOSEST_MATCHES"] = "all-closest-matches";
10
- ReturnTypeEnums$1["ALL_MATCHES"] = "all-matches";
11
- ReturnTypeEnums$1["ALL_SORTED_MATCHES"] = "all-sorted-matches";
12
- ReturnTypeEnums$1["FIRST_CLOSEST_MATCH"] = "first-closest-match";
13
- ReturnTypeEnums$1["FIRST_MATCH"] = "first-match";
14
- return ReturnTypeEnums$1;
15
- }({});
16
- let ThresholdTypeEnums = /* @__PURE__ */ function(ThresholdTypeEnums$1) {
17
- ThresholdTypeEnums$1["EDIT_DISTANCE"] = "edit-distance";
18
- ThresholdTypeEnums$1["SIMILARITY"] = "similarity";
19
- return ThresholdTypeEnums$1;
20
- }({});
21
- const fillDefaultOptions = (options) => {
22
- const optionsWithDefaultValues = {
23
- caseSensitive: false,
24
- deburr: true,
25
- matchPath: [],
26
- returnType: ReturnTypeEnums.FIRST_CLOSEST_MATCH,
27
- thresholdType: ThresholdTypeEnums.SIMILARITY,
28
- trimSpaces: true,
29
- ...options
30
- };
31
- if (!Object.values(ReturnTypeEnums).includes(optionsWithDefaultValues.returnType)) throw new TypeError("unknown returnType");
32
- if (!Object.values(ThresholdTypeEnums).includes(optionsWithDefaultValues.thresholdType)) throw new TypeError("unknown thresholdType");
33
- switch (optionsWithDefaultValues.thresholdType) {
34
- case ThresholdTypeEnums.EDIT_DISTANCE: return {
35
- threshold: 20,
36
- ...optionsWithDefaultValues
37
- };
38
- case ThresholdTypeEnums.SIMILARITY: return {
39
- threshold: .4,
40
- ...optionsWithDefaultValues
41
- };
42
- }
43
- };
44
- /**
45
- * Using edit distance between `a` and `b` to calculate similarity
46
- *
47
- * @param {string} a - `input`
48
- * @param {string} b - String from `matchList`
49
- * @returns {number} similarity between `a` and `b`
50
- */
51
- const getSimilarity = (a, b) => {
52
- if (!a || !b) return 0;
53
- if (a === b) return 1;
54
- const editDistance = (0, import_fastest_levenshtein.distance)(a, b);
55
- const longestLength = Math.max(a.length, b.length);
56
- return (longestLength - editDistance) / longestLength;
57
- };
58
- /**
59
- * Normalize a string
60
- *
61
- * @param {string} str - any string
62
- * @param {object} options - options that allows you to modify the behavior
63
- * @returns {string} - normalized string
64
- */
65
- const normalizeString = (str, options) => {
66
- let s = str;
67
- if (options.trimSpaces) s = s.trim().replaceAll(/\s+/gu, " ");
68
- if (options.deburr) s = (0, import_lodash.default)(s);
69
- if (!options.caseSensitive) s = s.toLowerCase();
70
- return s;
71
- };
72
- const getMatchItemStr = (matchItem, matchPath) => {
73
- const matchItemStr = matchPath.length > 0 ? matchPath.reduce((acc, prop) => {
74
- return acc?.[prop];
75
- }, matchItem) : matchItem;
76
- if (typeof matchItemStr !== "string") return "";
77
- return matchItemStr;
78
- };
79
- /**
80
- * Process matchItem according to options
81
- *
82
- * @param {object | string} matchItem - Item for matching with `input`
83
- * @param {object} options - options that allows you to modify the behavior
84
- * @returns {string} - processed matchItem
85
- */
86
- const matchItemProcessor = (matchItem, options) => {
87
- const { matchPath } = options;
88
- return normalizeString(getMatchItemStr(matchItem, matchPath), options);
89
- };
90
- /**
91
- * Generate result
92
- *
93
- * @param {object[] | string[]} matchList - List for matching with `input`
94
- * @param {number[]} matchedIndexes - indexes of matchList that need to be returned as result
95
- * @param {ReturnTypeEnums} returnType - how the result will response to user
96
- * @returns {Array | null | object | string} - matched result(s), return object if `match` is `{Object[]}`
97
- */
98
- const resultProcessor = (matchList, matchedIndexes, returnType) => {
99
- switch (returnType) {
100
- case ReturnTypeEnums.ALL_CLOSEST_MATCHES:
101
- case ReturnTypeEnums.ALL_MATCHES:
102
- case ReturnTypeEnums.ALL_SORTED_MATCHES: return matchedIndexes.map((matchedIndex) => matchList[matchedIndex]);
103
- case ReturnTypeEnums.FIRST_CLOSEST_MATCH:
104
- case ReturnTypeEnums.FIRST_MATCH: {
105
- const matchedIndex = matchedIndexes[0];
106
- if (matchedIndex === void 0) return null;
107
- return matchList[matchedIndex];
108
- }
109
- }
110
- };
111
- /**
112
- * Main function for didyoumean2
113
- *
114
- * @param {string} input - string that you are not sure and want to match with `matchList`
115
- * @param {object[] | string[]} matchList - List for matching with `input`
116
- * @param {null | object | undefined} options - options that allows you to modify the behavior
117
- * @returns {Array | null | object | string} - matched result(s), return object if `match` is `{Object[]}`
118
- */
119
- function didYouMean(input, matchList, options) {
120
- const optionsWithDefaults = fillDefaultOptions(options);
121
- const { returnType, threshold, thresholdType } = optionsWithDefaults;
122
- const normalizedInput = normalizeString(input, optionsWithDefaults);
123
- let checkIfMatched;
124
- let scoreProcessor;
125
- switch (thresholdType) {
126
- case ThresholdTypeEnums.EDIT_DISTANCE:
127
- checkIfMatched = (score) => score <= threshold;
128
- scoreProcessor = (matchItem) => (0, import_fastest_levenshtein.distance)(normalizedInput, matchItemProcessor(matchItem, optionsWithDefaults));
129
- break;
130
- case ThresholdTypeEnums.SIMILARITY:
131
- checkIfMatched = (score) => score >= threshold;
132
- scoreProcessor = (matchItem) => getSimilarity(normalizedInput, matchItemProcessor(matchItem, optionsWithDefaults));
133
- break;
134
- }
135
- const matchedIndexes = [];
136
- switch (returnType) {
137
- case ReturnTypeEnums.ALL_CLOSEST_MATCHES:
138
- case ReturnTypeEnums.FIRST_CLOSEST_MATCH: {
139
- const scores = [];
140
- let marginValue;
141
- switch (thresholdType) {
142
- case ThresholdTypeEnums.EDIT_DISTANCE:
143
- marginValue = Number.POSITIVE_INFINITY;
144
- for (const matchItem of matchList) {
145
- const score = scoreProcessor(matchItem);
146
- if (marginValue > score) marginValue = score;
147
- scores.push(score);
148
- }
149
- break;
150
- case ThresholdTypeEnums.SIMILARITY:
151
- marginValue = 0;
152
- for (const matchItem of matchList) {
153
- const score = scoreProcessor(matchItem);
154
- if (marginValue < score) marginValue = score;
155
- scores.push(score);
156
- }
157
- break;
158
- }
159
- for (const [i, score] of scores.entries()) if (checkIfMatched(score) && score === marginValue) matchedIndexes.push(i);
160
- break;
161
- }
162
- case ReturnTypeEnums.ALL_MATCHES:
163
- for (const [i, matchItem] of matchList.entries()) {
164
- const score = scoreProcessor(matchItem);
165
- if (checkIfMatched(score)) matchedIndexes.push(i);
166
- }
167
- break;
168
- case ReturnTypeEnums.ALL_SORTED_MATCHES: {
169
- const unsortedResults = [];
170
- for (const [i, matchItem] of matchList.entries()) {
171
- const score = scoreProcessor(matchItem);
172
- if (checkIfMatched(score)) unsortedResults.push({
173
- score,
174
- index: i
175
- });
176
- }
177
- switch (thresholdType) {
178
- case ThresholdTypeEnums.EDIT_DISTANCE:
179
- unsortedResults.sort((a, b) => a.score - b.score);
180
- break;
181
- case ThresholdTypeEnums.SIMILARITY:
182
- unsortedResults.sort((a, b) => b.score - a.score);
183
- break;
184
- }
185
- for (const unsortedResult of unsortedResults) matchedIndexes.push(unsortedResult.index);
186
- break;
187
- }
188
- case ReturnTypeEnums.FIRST_MATCH:
189
- for (const [i, matchItem] of matchList.entries()) {
190
- const score = scoreProcessor(matchItem);
191
- if (checkIfMatched(score)) {
192
- matchedIndexes.push(i);
193
- break;
194
- }
195
- }
196
- break;
197
- }
198
- return resultProcessor(matchList, matchedIndexes, returnType);
199
- }
200
-
201
- //#endregion
202
- export { ReturnTypeEnums, ThresholdTypeEnums, didYouMean as default };
203
- //# sourceMappingURL=index.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.mjs","names":["ReturnTypeEnums","ThresholdTypeEnums"],"sources":["../../../../../../../../../node_modules/.pnpm/didyoumean2@7.0.4/node_modules/didyoumean2/dist/index.mjs"],"sourcesContent":["import { distance } from 'fastest-levenshtein';\nimport deburr from 'lodash.deburr';\n\nlet ReturnTypeEnums = /*#__PURE__*/function (ReturnTypeEnums) {\n ReturnTypeEnums[\"ALL_CLOSEST_MATCHES\"] = \"all-closest-matches\";\n ReturnTypeEnums[\"ALL_MATCHES\"] = \"all-matches\";\n ReturnTypeEnums[\"ALL_SORTED_MATCHES\"] = \"all-sorted-matches\";\n ReturnTypeEnums[\"FIRST_CLOSEST_MATCH\"] = \"first-closest-match\";\n ReturnTypeEnums[\"FIRST_MATCH\"] = \"first-match\";\n return ReturnTypeEnums;\n}({});\n\nlet ThresholdTypeEnums = /*#__PURE__*/function (ThresholdTypeEnums) {\n ThresholdTypeEnums[\"EDIT_DISTANCE\"] = \"edit-distance\";\n ThresholdTypeEnums[\"SIMILARITY\"] = \"similarity\";\n return ThresholdTypeEnums;\n}({});\n\nconst fillDefaultOptions = options => {\n const optionsWithDefaultValues = {\n caseSensitive: false,\n deburr: true,\n matchPath: [],\n returnType: ReturnTypeEnums.FIRST_CLOSEST_MATCH,\n thresholdType: ThresholdTypeEnums.SIMILARITY,\n trimSpaces: true,\n ...options\n };\n if (!Object.values(ReturnTypeEnums).includes(optionsWithDefaultValues.returnType)) {\n throw new TypeError('unknown returnType');\n }\n if (!Object.values(ThresholdTypeEnums).includes(optionsWithDefaultValues.thresholdType)) {\n throw new TypeError('unknown thresholdType');\n }\n switch (optionsWithDefaultValues.thresholdType) {\n case ThresholdTypeEnums.EDIT_DISTANCE:\n return {\n threshold: 20,\n ...optionsWithDefaultValues\n };\n case ThresholdTypeEnums.SIMILARITY:\n return {\n threshold: 0.4,\n ...optionsWithDefaultValues\n };\n }\n};\n\n/**\n * Using edit distance between `a` and `b` to calculate similarity\n *\n * @param {string} a - `input`\n * @param {string} b - String from `matchList`\n * @returns {number} similarity between `a` and `b`\n */\nconst getSimilarity = (a, b) => {\n if (!a || !b) return 0;\n if (a === b) return 1;\n const editDistance = distance(a, b);\n const longestLength = Math.max(a.length, b.length);\n return (longestLength - editDistance) / longestLength;\n};\n\n/**\n * Normalize a string\n *\n * @param {string} str - any string\n * @param {object} options - options that allows you to modify the behavior\n * @returns {string} - normalized string\n */\nconst normalizeString = (str, options) => {\n let s = str;\n if (options.trimSpaces) {\n s = s.trim().replaceAll(/\\s+/gu, ' ');\n }\n if (options.deburr) {\n s = deburr(s);\n }\n if (!options.caseSensitive) {\n s = s.toLowerCase();\n }\n return s;\n};\n\nconst getMatchItemStr = (matchItem, matchPath) => {\n const matchItemStr = matchPath.length > 0 ? matchPath.reduce((acc, prop) => {\n // @ts-expect-error skip redundant type check\n return acc?.[prop];\n }, matchItem) : matchItem;\n if (typeof matchItemStr !== 'string') return '';\n return matchItemStr;\n};\n\n/**\n * Process matchItem according to options\n *\n * @param {object | string} matchItem - Item for matching with `input`\n * @param {object} options - options that allows you to modify the behavior\n * @returns {string} - processed matchItem\n */\nconst matchItemProcessor = (matchItem, options) => {\n const {\n matchPath\n } = options;\n const matchItemStr = getMatchItemStr(matchItem, matchPath);\n return normalizeString(matchItemStr, options);\n};\n\n/**\n * Generate result\n *\n * @param {object[] | string[]} matchList - List for matching with `input`\n * @param {number[]} matchedIndexes - indexes of matchList that need to be returned as result\n * @param {ReturnTypeEnums} returnType - how the result will response to user\n * @returns {Array | null | object | string} - matched result(s), return object if `match` is `{Object[]}`\n */\nconst resultProcessor = (matchList, matchedIndexes, returnType\n// eslint-disable-next-line functional/prefer-immutable-types\n) => {\n switch (returnType) {\n case ReturnTypeEnums.ALL_CLOSEST_MATCHES:\n case ReturnTypeEnums.ALL_MATCHES:\n case ReturnTypeEnums.ALL_SORTED_MATCHES:\n return matchedIndexes.map(matchedIndex => matchList[matchedIndex]);\n case ReturnTypeEnums.FIRST_CLOSEST_MATCH:\n case ReturnTypeEnums.FIRST_MATCH:\n {\n const matchedIndex = matchedIndexes[0];\n if (matchedIndex === undefined) return null;\n return matchList[matchedIndex];\n }\n }\n};\n\n/**\n * Main function for didyoumean2\n *\n * @param {string} input - string that you are not sure and want to match with `matchList`\n * @param {object[] | string[]} matchList - List for matching with `input`\n * @param {null | object | undefined} options - options that allows you to modify the behavior\n * @returns {Array | null | object | string} - matched result(s), return object if `match` is `{Object[]}`\n */\nfunction didYouMean(input, matchList, options\n// eslint-disable-next-line functional/prefer-immutable-types\n) {\n /*+++++++++++++++++++\n + Initiate options +\n +++++++++++++++++++*/\n\n const optionsWithDefaults = fillDefaultOptions(options);\n const {\n returnType,\n threshold,\n thresholdType\n } = optionsWithDefaults;\n\n /*++++++++++++++++++++\n + Deal with options +\n ++++++++++++++++++++*/\n\n const normalizedInput = normalizeString(input, optionsWithDefaults);\n let checkIfMatched; // Validate if score is matched\n let scoreProcessor; // Get score\n switch (thresholdType) {\n case ThresholdTypeEnums.EDIT_DISTANCE:\n checkIfMatched = score => score <= threshold;\n scoreProcessor = matchItem => distance(normalizedInput, matchItemProcessor(matchItem, optionsWithDefaults));\n break;\n case ThresholdTypeEnums.SIMILARITY:\n checkIfMatched = score => score >= threshold;\n scoreProcessor = matchItem => getSimilarity(normalizedInput, matchItemProcessor(matchItem, optionsWithDefaults));\n break;\n }\n\n /*+++++++++++\n + Matching +\n +++++++++++*/\n\n // eslint-disable-next-line functional/prefer-immutable-types\n const matchedIndexes = [];\n switch (returnType) {\n case ReturnTypeEnums.ALL_CLOSEST_MATCHES:\n case ReturnTypeEnums.FIRST_CLOSEST_MATCH:\n {\n // eslint-disable-next-line functional/prefer-immutable-types\n const scores = [];\n let marginValue;\n switch (thresholdType) {\n case ThresholdTypeEnums.EDIT_DISTANCE:\n // Process score and save the smallest score\n marginValue = Number.POSITIVE_INFINITY;\n for (const matchItem of matchList) {\n const score = scoreProcessor(matchItem);\n if (marginValue > score) marginValue = score;\n scores.push(score);\n }\n break;\n case ThresholdTypeEnums.SIMILARITY:\n // Process score and save the largest score\n marginValue = 0;\n for (const matchItem of matchList) {\n const score = scoreProcessor(matchItem);\n if (marginValue < score) marginValue = score;\n scores.push(score);\n }\n break;\n }\n for (const [i, score] of scores.entries()) {\n if (checkIfMatched(score) && score === marginValue) {\n matchedIndexes.push(i);\n }\n }\n break;\n }\n case ReturnTypeEnums.ALL_MATCHES:\n for (const [i, matchItem] of matchList.entries()) {\n const score = scoreProcessor(matchItem);\n\n // save all indexes of matched scores\n if (checkIfMatched(score)) {\n matchedIndexes.push(i);\n }\n }\n break;\n case ReturnTypeEnums.ALL_SORTED_MATCHES:\n {\n // eslint-disable-next-line functional/prefer-immutable-types\n const unsortedResults = [];\n for (const [i, matchItem] of matchList.entries()) {\n const score = scoreProcessor(matchItem);\n\n // save all indexes of matched scores\n if (checkIfMatched(score)) {\n unsortedResults.push({\n score,\n index: i\n });\n }\n }\n switch (thresholdType) {\n case ThresholdTypeEnums.EDIT_DISTANCE:\n unsortedResults.sort((a, b) => a.score - b.score);\n break;\n case ThresholdTypeEnums.SIMILARITY:\n unsortedResults.sort((a, b) => b.score - a.score);\n break;\n }\n for (const unsortedResult of unsortedResults) {\n matchedIndexes.push(unsortedResult.index);\n }\n break;\n }\n case ReturnTypeEnums.FIRST_MATCH:\n for (const [i, matchItem] of matchList.entries()) {\n const score = scoreProcessor(matchItem);\n\n // Return once matched, performance is main target in this returnType\n if (checkIfMatched(score)) {\n matchedIndexes.push(i);\n break;\n }\n }\n break;\n }\n\n /*+++++++++++++++++++++++\n + Process return value +\n +++++++++++++++++++++++*/\n\n return resultProcessor(matchList, matchedIndexes, returnType);\n}\n\n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