es-toolkit 1.10.1-dev.248 → 1.10.1-dev.250
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/chunk-SR5RPVRM.mjs +9 -0
- package/dist/chunk-SR5RPVRM.mjs.map +1 -0
- package/dist/chunk-YCTGSM4S.mjs +1 -0
- package/dist/chunk-ZFRI6VS4.mjs +9 -0
- package/dist/chunk-ZFRI6VS4.mjs.map +1 -0
- package/dist/compat/index.d.mts +2 -0
- package/dist/compat/index.d.ts +2 -0
- package/dist/compat/index.js +14 -0
- package/dist/compat/index.js.map +1 -1
- package/dist/compat/index.mjs +12 -4
- package/dist/compat/index.mjs.map +1 -1
- package/dist/index.d.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -4
- package/dist/string/endsWith.d.mts +20 -0
- package/dist/string/endsWith.d.ts +20 -0
- package/dist/string/endsWith.js +33 -0
- package/dist/string/endsWith.js.map +1 -0
- package/dist/string/endsWith.mjs +8 -0
- package/dist/string/endsWith.mjs.map +1 -0
- package/dist/string/index.d.mts +2 -0
- package/dist/string/index.d.ts +2 -0
- package/dist/string/index.js +16 -2
- package/dist/string/index.js.map +1 -1
- package/dist/string/index.mjs +13 -5
- package/dist/string/startsWith.d.mts +20 -0
- package/dist/string/startsWith.d.ts +20 -0
- package/dist/string/startsWith.js +33 -0
- package/dist/string/startsWith.js.map +1 -0
- package/dist/string/startsWith.mjs +8 -0
- package/dist/string/startsWith.mjs.map +1 -0
- package/package.json +1 -1
- package/dist/chunk-XT74R35S.mjs +0 -1
- /package/dist/{chunk-XT74R35S.mjs.map → chunk-YCTGSM4S.mjs.map} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/string/startsWith.ts"],"sourcesContent":["/**\n * Checks if a string contains another string at the beginning of the string.\n *\n * Checks if one string startsWith another string. Optional position parameter to start searching from a certain index.\n *\n * @param {string} str - The string that might contain the target string.\n * @param {string} target - The string to search for.\n * @param {number} position - An optional offset to start searching in the str string\n * @returns {boolean} - True if the str string starts with the target string.\n *\n * @example\n * const isPrefix = startsWith('fooBar', 'foo') // returns true\n * const isPrefix = startsWith('fooBar', 'bar') // returns false\n * const isPrefix = startsWith('fooBar', 'abc') // returns false\n * const isPrefix = startsWith('fooBar', 'Bar', 2) // returns true\n * const isPrefix = startsWith('fooBar', 'Bar', 5) // returns false\n */\nexport const startsWith = (str: string, target: string, position: number = 0): boolean => {\n return str.startsWith(target, position);\n};\n"],"mappings":";AAiBO,IAAM,aAAa,CAAC,KAAa,QAAgB,WAAmB,MAAe;AACxF,SAAO,IAAI,WAAW,QAAQ,QAAQ;AACxC;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=chunk-YCTGSM4S.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/string/endsWith.ts"],"sourcesContent":["/**\n * Checks if a string contains another string at the end of the string.\n *\n * Checks if one string endsWith another string. Optional position parameter to offset searching before a certain index.\n *\n * @param {string} str - The string that might contain the target string.\n * @param {string} target - The string to search for.\n * @param {number} position - An optional position from the start to search up to this index\n * @returns {boolean} - True if the str string ends with the target string.\n *\n * @example\n * const isPrefix = endsWith('fooBar', 'foo') // returns true\n * const isPrefix = endsWith('fooBar', 'bar') // returns false\n * const isPrefix = endsWith('fooBar', 'abc') // returns false\n * const isPrefix = endsWith('fooBar', 'foo', 3) // returns true\n * const isPrefix = endsWith('fooBar', 'abc', 5) // returns false\n */\nexport const endsWith = (str: string, target: string, position: number = str.length): boolean => {\n return str.endsWith(target, position);\n};\n"],"mappings":";AAiBO,IAAM,WAAW,CAAC,KAAa,QAAgB,WAAmB,IAAI,WAAoB;AAC/F,SAAO,IAAI,SAAS,QAAQ,QAAQ;AACtC;","names":[]}
|
package/dist/compat/index.d.mts
CHANGED
|
@@ -82,6 +82,8 @@ export { snakeCase } from '../string/snakeCase.mjs';
|
|
|
82
82
|
export { kebabCase } from '../string/kebabCase.mjs';
|
|
83
83
|
export { lowerCase } from '../string/lowerCase.mjs';
|
|
84
84
|
export { startCase } from '../string/startCase.mjs';
|
|
85
|
+
export { startsWith } from '../string/startsWith.mjs';
|
|
86
|
+
export { endsWith } from '../string/endsWith.mjs';
|
|
85
87
|
export { capitalize } from '../string/capitalize.mjs';
|
|
86
88
|
|
|
87
89
|
/**
|
package/dist/compat/index.d.ts
CHANGED
|
@@ -82,6 +82,8 @@ export { snakeCase } from '../string/snakeCase.js';
|
|
|
82
82
|
export { kebabCase } from '../string/kebabCase.js';
|
|
83
83
|
export { lowerCase } from '../string/lowerCase.js';
|
|
84
84
|
export { startCase } from '../string/startCase.js';
|
|
85
|
+
export { startsWith } from '../string/startsWith.js';
|
|
86
|
+
export { endsWith } from '../string/endsWith.js';
|
|
85
87
|
export { capitalize } from '../string/capitalize.js';
|
|
86
88
|
|
|
87
89
|
/**
|
package/dist/compat/index.js
CHANGED
|
@@ -51,6 +51,7 @@ __export(compat_exports, {
|
|
|
51
51
|
dropRight: () => dropRight,
|
|
52
52
|
dropRightWhile: () => dropRightWhile,
|
|
53
53
|
dropWhile: () => dropWhile,
|
|
54
|
+
endsWith: () => endsWith,
|
|
54
55
|
fill: () => fill,
|
|
55
56
|
flatMap: () => flatMap,
|
|
56
57
|
flatten: () => flatten,
|
|
@@ -97,6 +98,7 @@ __export(compat_exports, {
|
|
|
97
98
|
shuffle: () => shuffle,
|
|
98
99
|
snakeCase: () => snakeCase,
|
|
99
100
|
startCase: () => startCase,
|
|
101
|
+
startsWith: () => startsWith,
|
|
100
102
|
sum: () => sum,
|
|
101
103
|
sumBy: () => sumBy,
|
|
102
104
|
tail: () => tail,
|
|
@@ -1043,6 +1045,16 @@ function startCase(str) {
|
|
|
1043
1045
|
return result;
|
|
1044
1046
|
}
|
|
1045
1047
|
|
|
1048
|
+
// src/string/startsWith.ts
|
|
1049
|
+
var startsWith = (str, target, position = 0) => {
|
|
1050
|
+
return str.startsWith(target, position);
|
|
1051
|
+
};
|
|
1052
|
+
|
|
1053
|
+
// src/string/endsWith.ts
|
|
1054
|
+
var endsWith = (str, target, position = str.length) => {
|
|
1055
|
+
return str.endsWith(target, position);
|
|
1056
|
+
};
|
|
1057
|
+
|
|
1046
1058
|
// src/compat/array/chunk.ts
|
|
1047
1059
|
function chunk2(arr, size = 1) {
|
|
1048
1060
|
size = Math.max(Math.floor(size), 0);
|
|
@@ -1141,6 +1153,7 @@ function zipObjectDeep(keys, values) {
|
|
|
1141
1153
|
dropRight,
|
|
1142
1154
|
dropRightWhile,
|
|
1143
1155
|
dropWhile,
|
|
1156
|
+
endsWith,
|
|
1144
1157
|
fill,
|
|
1145
1158
|
flatMap,
|
|
1146
1159
|
flatten,
|
|
@@ -1187,6 +1200,7 @@ function zipObjectDeep(keys, values) {
|
|
|
1187
1200
|
shuffle,
|
|
1188
1201
|
snakeCase,
|
|
1189
1202
|
startCase,
|
|
1203
|
+
startsWith,
|
|
1190
1204
|
sum,
|
|
1191
1205
|
sumBy,
|
|
1192
1206
|
tail,
|