es-toolkit 1.10.1-dev.250 → 1.10.1-dev.251
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-XT74R35S.mjs +1 -0
- package/dist/compat/index.d.mts +39 -3
- package/dist/compat/index.d.ts +39 -3
- package/dist/compat/index.js +10 -10
- package/dist/compat/index.js.map +1 -1
- package/dist/compat/index.mjs +14 -10
- package/dist/compat/index.mjs.map +1 -1
- package/dist/index.d.mts +0 -2
- package/dist/index.d.ts +0 -2
- package/dist/index.js +0 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -12
- package/dist/string/index.d.mts +0 -2
- package/dist/string/index.d.ts +0 -2
- package/dist/string/index.js +2 -16
- package/dist/string/index.js.map +1 -1
- package/dist/string/index.mjs +5 -13
- package/package.json +1 -1
- package/dist/chunk-SR5RPVRM.mjs +0 -9
- package/dist/chunk-SR5RPVRM.mjs.map +0 -1
- package/dist/chunk-YCTGSM4S.mjs +0 -1
- package/dist/chunk-ZFRI6VS4.mjs +0 -9
- package/dist/chunk-ZFRI6VS4.mjs.map +0 -1
- package/dist/string/endsWith.d.mts +0 -20
- package/dist/string/endsWith.d.ts +0 -20
- package/dist/string/endsWith.js +0 -33
- package/dist/string/endsWith.js.map +0 -1
- package/dist/string/endsWith.mjs +0 -8
- package/dist/string/endsWith.mjs.map +0 -1
- package/dist/string/startsWith.d.mts +0 -20
- package/dist/string/startsWith.d.ts +0 -20
- package/dist/string/startsWith.js +0 -33
- package/dist/string/startsWith.js.map +0 -1
- package/dist/string/startsWith.mjs +0 -8
- package/dist/string/startsWith.mjs.map +0 -1
- /package/dist/{chunk-YCTGSM4S.mjs.map → chunk-XT74R35S.mjs.map} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=chunk-XT74R35S.mjs.map
|
package/dist/compat/index.d.mts
CHANGED
|
@@ -82,8 +82,6 @@ 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';
|
|
87
85
|
export { capitalize } from '../string/capitalize.mjs';
|
|
88
86
|
|
|
89
87
|
/**
|
|
@@ -176,4 +174,42 @@ declare function zipObjectDeep<P extends string | number | symbol, V>(keys: P[],
|
|
|
176
174
|
*/
|
|
177
175
|
declare function set<T>(obj: object, path: PropertyKey | readonly PropertyKey[], value: unknown): T;
|
|
178
176
|
|
|
179
|
-
|
|
177
|
+
/**
|
|
178
|
+
* Checks if a string contains another string at the beginning of the string.
|
|
179
|
+
*
|
|
180
|
+
* Checks if one string startsWith another string. Optional position parameter to start searching from a certain index.
|
|
181
|
+
*
|
|
182
|
+
* @param {string} str - The string that might contain the target string.
|
|
183
|
+
* @param {string} target - The string to search for.
|
|
184
|
+
* @param {number} position - An optional offset to start searching in the str string
|
|
185
|
+
* @returns {boolean} - True if the str string starts with the target string.
|
|
186
|
+
*
|
|
187
|
+
* @example
|
|
188
|
+
* const isPrefix = startsWith('fooBar', 'foo') // returns true
|
|
189
|
+
* const isPrefix = startsWith('fooBar', 'bar') // returns false
|
|
190
|
+
* const isPrefix = startsWith('fooBar', 'abc') // returns false
|
|
191
|
+
* const isPrefix = startsWith('fooBar', 'Bar', 2) // returns true
|
|
192
|
+
* const isPrefix = startsWith('fooBar', 'Bar', 5) // returns false
|
|
193
|
+
*/
|
|
194
|
+
declare const startsWith: (str: string, target: string, position?: number) => boolean;
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Checks if a string contains another string at the end of the string.
|
|
198
|
+
*
|
|
199
|
+
* Checks if one string endsWith another string. Optional position parameter to offset searching before a certain index.
|
|
200
|
+
*
|
|
201
|
+
* @param {string} str - The string that might contain the target string.
|
|
202
|
+
* @param {string} target - The string to search for.
|
|
203
|
+
* @param {number} position - An optional position from the start to search up to this index
|
|
204
|
+
* @returns {boolean} - True if the str string ends with the target string.
|
|
205
|
+
*
|
|
206
|
+
* @example
|
|
207
|
+
* const isPrefix = endsWith('fooBar', 'foo') // returns true
|
|
208
|
+
* const isPrefix = endsWith('fooBar', 'bar') // returns false
|
|
209
|
+
* const isPrefix = endsWith('fooBar', 'abc') // returns false
|
|
210
|
+
* const isPrefix = endsWith('fooBar', 'foo', 3) // returns true
|
|
211
|
+
* const isPrefix = endsWith('fooBar', 'abc', 5) // returns false
|
|
212
|
+
*/
|
|
213
|
+
declare const endsWith: (str: string, target: string, position?: number) => boolean;
|
|
214
|
+
|
|
215
|
+
export { chunk, endsWith, set, startsWith, zipObjectDeep };
|
package/dist/compat/index.d.ts
CHANGED
|
@@ -82,8 +82,6 @@ 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';
|
|
87
85
|
export { capitalize } from '../string/capitalize.js';
|
|
88
86
|
|
|
89
87
|
/**
|
|
@@ -176,4 +174,42 @@ declare function zipObjectDeep<P extends string | number | symbol, V>(keys: P[],
|
|
|
176
174
|
*/
|
|
177
175
|
declare function set<T>(obj: object, path: PropertyKey | readonly PropertyKey[], value: unknown): T;
|
|
178
176
|
|
|
179
|
-
|
|
177
|
+
/**
|
|
178
|
+
* Checks if a string contains another string at the beginning of the string.
|
|
179
|
+
*
|
|
180
|
+
* Checks if one string startsWith another string. Optional position parameter to start searching from a certain index.
|
|
181
|
+
*
|
|
182
|
+
* @param {string} str - The string that might contain the target string.
|
|
183
|
+
* @param {string} target - The string to search for.
|
|
184
|
+
* @param {number} position - An optional offset to start searching in the str string
|
|
185
|
+
* @returns {boolean} - True if the str string starts with the target string.
|
|
186
|
+
*
|
|
187
|
+
* @example
|
|
188
|
+
* const isPrefix = startsWith('fooBar', 'foo') // returns true
|
|
189
|
+
* const isPrefix = startsWith('fooBar', 'bar') // returns false
|
|
190
|
+
* const isPrefix = startsWith('fooBar', 'abc') // returns false
|
|
191
|
+
* const isPrefix = startsWith('fooBar', 'Bar', 2) // returns true
|
|
192
|
+
* const isPrefix = startsWith('fooBar', 'Bar', 5) // returns false
|
|
193
|
+
*/
|
|
194
|
+
declare const startsWith: (str: string, target: string, position?: number) => boolean;
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Checks if a string contains another string at the end of the string.
|
|
198
|
+
*
|
|
199
|
+
* Checks if one string endsWith another string. Optional position parameter to offset searching before a certain index.
|
|
200
|
+
*
|
|
201
|
+
* @param {string} str - The string that might contain the target string.
|
|
202
|
+
* @param {string} target - The string to search for.
|
|
203
|
+
* @param {number} position - An optional position from the start to search up to this index
|
|
204
|
+
* @returns {boolean} - True if the str string ends with the target string.
|
|
205
|
+
*
|
|
206
|
+
* @example
|
|
207
|
+
* const isPrefix = endsWith('fooBar', 'foo') // returns true
|
|
208
|
+
* const isPrefix = endsWith('fooBar', 'bar') // returns false
|
|
209
|
+
* const isPrefix = endsWith('fooBar', 'abc') // returns false
|
|
210
|
+
* const isPrefix = endsWith('fooBar', 'foo', 3) // returns true
|
|
211
|
+
* const isPrefix = endsWith('fooBar', 'abc', 5) // returns false
|
|
212
|
+
*/
|
|
213
|
+
declare const endsWith: (str: string, target: string, position?: number) => boolean;
|
|
214
|
+
|
|
215
|
+
export { chunk, endsWith, set, startsWith, zipObjectDeep };
|
package/dist/compat/index.js
CHANGED
|
@@ -1045,16 +1045,6 @@ function startCase(str) {
|
|
|
1045
1045
|
return result;
|
|
1046
1046
|
}
|
|
1047
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
|
-
|
|
1058
1048
|
// src/compat/array/chunk.ts
|
|
1059
1049
|
function chunk2(arr, size = 1) {
|
|
1060
1050
|
size = Math.max(Math.floor(size), 0);
|
|
@@ -1134,6 +1124,16 @@ function zipObjectDeep(keys, values) {
|
|
|
1134
1124
|
}
|
|
1135
1125
|
return result;
|
|
1136
1126
|
}
|
|
1127
|
+
|
|
1128
|
+
// src/compat/string/startsWith.ts
|
|
1129
|
+
var startsWith = (str, target, position = 0) => {
|
|
1130
|
+
return str.startsWith(target, position);
|
|
1131
|
+
};
|
|
1132
|
+
|
|
1133
|
+
// src/compat/string/endsWith.ts
|
|
1134
|
+
var endsWith = (str, target, position = str.length) => {
|
|
1135
|
+
return str.endsWith(target, position);
|
|
1136
|
+
};
|
|
1137
1137
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1138
1138
|
0 && (module.exports = {
|
|
1139
1139
|
AbortError,
|