moderndash 3.11.1 → 3.12.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/dist/index.cjs +13 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +17 -13
- package/dist/index.d.ts +17 -13
- package/dist/index.js +13 -13
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -59,10 +59,12 @@ type CompareFunction<TArrays extends ArrayMinLength<unknown[], 2>> = (a: TArrays
|
|
|
59
59
|
type ArrayTail<TArray extends unknown[]> = TArray extends [unknown, ...infer U] ? U : never;
|
|
60
60
|
|
|
61
61
|
/**
|
|
62
|
-
*
|
|
62
|
+
* @deprecated **Deprecated: Use the native [Set.prototype.difference()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set/difference) function instead.**
|
|
63
63
|
*
|
|
64
|
+
* Create a new array with values from the first array that are not present in the other arrays.
|
|
64
65
|
* Optionally, use a compare function to determine the comparison of elements (default is `===`).
|
|
65
66
|
*
|
|
67
|
+
*
|
|
66
68
|
* @example
|
|
67
69
|
* difference([2, 1], [2, 3], [6])
|
|
68
70
|
* // => [1]
|
|
@@ -145,6 +147,8 @@ declare function dropWhile<TElem>(array: readonly TElem[], predicate: (value: TE
|
|
|
145
147
|
declare function group<TElem, TKey extends PropertyKey>(array: readonly TElem[], getGroupKey: (elem: TElem) => TKey): Record<TKey, TElem[]>;
|
|
146
148
|
|
|
147
149
|
/**
|
|
150
|
+
* @deprecated **Deprecated: Use the native [Set.prototype.intersection()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set/intersection) function instead.**
|
|
151
|
+
*
|
|
148
152
|
* Create an array with unique values that are present in all arrays.
|
|
149
153
|
* The order of the values is based on the first array.
|
|
150
154
|
*
|
|
@@ -1341,18 +1345,6 @@ declare function trimEnd(str: string, chars: string): string;
|
|
|
1341
1345
|
*/
|
|
1342
1346
|
declare function trimStart(str: string, chars: string): string;
|
|
1343
1347
|
|
|
1344
|
-
/**
|
|
1345
|
-
* Converts the HTML entities `&`, `<`, `>`, `"` and `'`
|
|
1346
|
-
* in a string to their corresponding characters.
|
|
1347
|
-
*
|
|
1348
|
-
* @example
|
|
1349
|
-
* unescapeHtml('fred, barney, & pebbles')
|
|
1350
|
-
* // => 'fred, barney, & pebbles'
|
|
1351
|
-
* @param str The string to unescape.
|
|
1352
|
-
* @returns Returns the unescaped string.
|
|
1353
|
-
*/
|
|
1354
|
-
declare function unescapeHtml(str: string): string;
|
|
1355
|
-
|
|
1356
1348
|
/**
|
|
1357
1349
|
* Truncates a string if it's longer than the given maximum length.
|
|
1358
1350
|
* The last characters of the truncated string are replaced with the ellipsis
|
|
@@ -1381,6 +1373,18 @@ declare function truncate(str: string, options?: {
|
|
|
1381
1373
|
separator?: string;
|
|
1382
1374
|
}): string;
|
|
1383
1375
|
|
|
1376
|
+
/**
|
|
1377
|
+
* Converts the HTML entities `&`, `<`, `>`, `"` and `'`
|
|
1378
|
+
* in a string to their corresponding characters.
|
|
1379
|
+
*
|
|
1380
|
+
* @example
|
|
1381
|
+
* unescapeHtml('fred, barney, & pebbles')
|
|
1382
|
+
* // => 'fred, barney, & pebbles'
|
|
1383
|
+
* @param str The string to unescape.
|
|
1384
|
+
* @returns Returns the unescaped string.
|
|
1385
|
+
*/
|
|
1386
|
+
declare function unescapeHtml(str: string): string;
|
|
1387
|
+
|
|
1384
1388
|
/**
|
|
1385
1389
|
* Checks if a value is empty.
|
|
1386
1390
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -59,10 +59,12 @@ type CompareFunction<TArrays extends ArrayMinLength<unknown[], 2>> = (a: TArrays
|
|
|
59
59
|
type ArrayTail<TArray extends unknown[]> = TArray extends [unknown, ...infer U] ? U : never;
|
|
60
60
|
|
|
61
61
|
/**
|
|
62
|
-
*
|
|
62
|
+
* @deprecated **Deprecated: Use the native [Set.prototype.difference()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set/difference) function instead.**
|
|
63
63
|
*
|
|
64
|
+
* Create a new array with values from the first array that are not present in the other arrays.
|
|
64
65
|
* Optionally, use a compare function to determine the comparison of elements (default is `===`).
|
|
65
66
|
*
|
|
67
|
+
*
|
|
66
68
|
* @example
|
|
67
69
|
* difference([2, 1], [2, 3], [6])
|
|
68
70
|
* // => [1]
|
|
@@ -145,6 +147,8 @@ declare function dropWhile<TElem>(array: readonly TElem[], predicate: (value: TE
|
|
|
145
147
|
declare function group<TElem, TKey extends PropertyKey>(array: readonly TElem[], getGroupKey: (elem: TElem) => TKey): Record<TKey, TElem[]>;
|
|
146
148
|
|
|
147
149
|
/**
|
|
150
|
+
* @deprecated **Deprecated: Use the native [Set.prototype.intersection()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set/intersection) function instead.**
|
|
151
|
+
*
|
|
148
152
|
* Create an array with unique values that are present in all arrays.
|
|
149
153
|
* The order of the values is based on the first array.
|
|
150
154
|
*
|
|
@@ -1341,18 +1345,6 @@ declare function trimEnd(str: string, chars: string): string;
|
|
|
1341
1345
|
*/
|
|
1342
1346
|
declare function trimStart(str: string, chars: string): string;
|
|
1343
1347
|
|
|
1344
|
-
/**
|
|
1345
|
-
* Converts the HTML entities `&`, `<`, `>`, `"` and `'`
|
|
1346
|
-
* in a string to their corresponding characters.
|
|
1347
|
-
*
|
|
1348
|
-
* @example
|
|
1349
|
-
* unescapeHtml('fred, barney, & pebbles')
|
|
1350
|
-
* // => 'fred, barney, & pebbles'
|
|
1351
|
-
* @param str The string to unescape.
|
|
1352
|
-
* @returns Returns the unescaped string.
|
|
1353
|
-
*/
|
|
1354
|
-
declare function unescapeHtml(str: string): string;
|
|
1355
|
-
|
|
1356
1348
|
/**
|
|
1357
1349
|
* Truncates a string if it's longer than the given maximum length.
|
|
1358
1350
|
* The last characters of the truncated string are replaced with the ellipsis
|
|
@@ -1381,6 +1373,18 @@ declare function truncate(str: string, options?: {
|
|
|
1381
1373
|
separator?: string;
|
|
1382
1374
|
}): string;
|
|
1383
1375
|
|
|
1376
|
+
/**
|
|
1377
|
+
* Converts the HTML entities `&`, `<`, `>`, `"` and `'`
|
|
1378
|
+
* in a string to their corresponding characters.
|
|
1379
|
+
*
|
|
1380
|
+
* @example
|
|
1381
|
+
* unescapeHtml('fred, barney, & pebbles')
|
|
1382
|
+
* // => 'fred, barney, & pebbles'
|
|
1383
|
+
* @param str The string to unescape.
|
|
1384
|
+
* @returns Returns the unescaped string.
|
|
1385
|
+
*/
|
|
1386
|
+
declare function unescapeHtml(str: string): string;
|
|
1387
|
+
|
|
1384
1388
|
/**
|
|
1385
1389
|
* Checks if a value is empty.
|
|
1386
1390
|
*
|
package/dist/index.js
CHANGED
|
@@ -822,19 +822,6 @@ function trimStart(str, chars) {
|
|
|
822
822
|
return str.slice(startIndex);
|
|
823
823
|
}
|
|
824
824
|
|
|
825
|
-
// src/string/unescapeHtml.ts
|
|
826
|
-
var htmlEntitiesRegex = /&(?:amp|lt|gt|quot|#39);/g;
|
|
827
|
-
var entityMap = /* @__PURE__ */ new Map([
|
|
828
|
-
["&", "&"],
|
|
829
|
-
["<", "<"],
|
|
830
|
-
[">", ">"],
|
|
831
|
-
[""", '"'],
|
|
832
|
-
["'", "'"]
|
|
833
|
-
]);
|
|
834
|
-
function unescapeHtml(str) {
|
|
835
|
-
return str.replace(htmlEntitiesRegex, (entity) => entityMap.get(entity));
|
|
836
|
-
}
|
|
837
|
-
|
|
838
825
|
// src/string/truncate.ts
|
|
839
826
|
function truncate(str, options) {
|
|
840
827
|
const { length = 30, ellipsis = "...", separator } = options ?? {};
|
|
@@ -853,6 +840,19 @@ function truncate(str, options) {
|
|
|
853
840
|
return truncated + ellipsis;
|
|
854
841
|
}
|
|
855
842
|
|
|
843
|
+
// src/string/unescapeHtml.ts
|
|
844
|
+
var htmlEntitiesRegex = /&(?:amp|lt|gt|quot|#39);/g;
|
|
845
|
+
var entityMap = /* @__PURE__ */ new Map([
|
|
846
|
+
["&", "&"],
|
|
847
|
+
["<", "<"],
|
|
848
|
+
[">", ">"],
|
|
849
|
+
[""", '"'],
|
|
850
|
+
["'", "'"]
|
|
851
|
+
]);
|
|
852
|
+
function unescapeHtml(str) {
|
|
853
|
+
return str.replace(htmlEntitiesRegex, (entity) => entityMap.get(entity));
|
|
854
|
+
}
|
|
855
|
+
|
|
856
856
|
// src/validate/isEmpty.ts
|
|
857
857
|
function isEmpty(value) {
|
|
858
858
|
if (value === null || value === void 0)
|