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/index.mjs CHANGED
@@ -1,21 +1,12 @@
1
1
  import "./chunk-NKLIE2OI.mjs";
2
2
  import "./chunk-ARZ5BDR6.mjs";
3
- import "./chunk-YCTGSM4S.mjs";
4
- import {
5
- startCase
6
- } from "./chunk-QXTNZR7B.mjs";
7
- import {
8
- startsWith
9
- } from "./chunk-SR5RPVRM.mjs";
3
+ import "./chunk-XT74R35S.mjs";
10
4
  import {
11
5
  camelCase
12
6
  } from "./chunk-Y5V7UAZZ.mjs";
13
7
  import {
14
8
  capitalize
15
9
  } from "./chunk-U56ZOM7L.mjs";
16
- import {
17
- endsWith
18
- } from "./chunk-ZFRI6VS4.mjs";
19
10
  import {
20
11
  kebabCase
21
12
  } from "./chunk-EYYZQFOP.mjs";
@@ -25,6 +16,9 @@ import {
25
16
  import {
26
17
  snakeCase
27
18
  } from "./chunk-F3WCQQET.mjs";
19
+ import {
20
+ startCase
21
+ } from "./chunk-QXTNZR7B.mjs";
28
22
  import "./chunk-WVQ7YVRK.mjs";
29
23
  import "./chunk-ASJF5D6C.mjs";
30
24
  import {
@@ -291,7 +285,6 @@ export {
291
285
  dropRight,
292
286
  dropRightWhile,
293
287
  dropWhile,
294
- endsWith,
295
288
  fill,
296
289
  flatMap,
297
290
  flatten,
@@ -337,7 +330,6 @@ export {
337
330
  shuffle,
338
331
  snakeCase,
339
332
  startCase,
340
- startsWith,
341
333
  sum,
342
334
  sumBy,
343
335
  tail,
@@ -3,6 +3,4 @@ export { snakeCase } from './snakeCase.mjs';
3
3
  export { kebabCase } from './kebabCase.mjs';
4
4
  export { lowerCase } from './lowerCase.mjs';
5
5
  export { startCase } from './startCase.mjs';
6
- export { startsWith } from './startsWith.mjs';
7
- export { endsWith } from './endsWith.mjs';
8
6
  export { capitalize } from './capitalize.mjs';
@@ -3,6 +3,4 @@ export { snakeCase } from './snakeCase.js';
3
3
  export { kebabCase } from './kebabCase.js';
4
4
  export { lowerCase } from './lowerCase.js';
5
5
  export { startCase } from './startCase.js';
6
- export { startsWith } from './startsWith.js';
7
- export { endsWith } from './endsWith.js';
8
6
  export { capitalize } from './capitalize.js';
@@ -22,12 +22,10 @@ var string_exports = {};
22
22
  __export(string_exports, {
23
23
  camelCase: () => camelCase,
24
24
  capitalize: () => capitalize,
25
- endsWith: () => endsWith,
26
25
  kebabCase: () => kebabCase,
27
26
  lowerCase: () => lowerCase,
28
27
  snakeCase: () => snakeCase,
29
- startCase: () => startCase,
30
- startsWith: () => startsWith
28
+ startCase: () => startCase
31
29
  });
32
30
  module.exports = __toCommonJS(string_exports);
33
31
 
@@ -87,25 +85,13 @@ function startCase(str) {
87
85
  }
88
86
  return result;
89
87
  }
90
-
91
- // src/string/startsWith.ts
92
- var startsWith = (str, target, position = 0) => {
93
- return str.startsWith(target, position);
94
- };
95
-
96
- // src/string/endsWith.ts
97
- var endsWith = (str, target, position = str.length) => {
98
- return str.endsWith(target, position);
99
- };
100
88
  // Annotate the CommonJS export names for ESM import in node:
101
89
  0 && (module.exports = {
102
90
  camelCase,
103
91
  capitalize,
104
- endsWith,
105
92
  kebabCase,
106
93
  lowerCase,
107
94
  snakeCase,
108
- startCase,
109
- startsWith
95
+ startCase
110
96
  });
111
97
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/string/index.ts","../../src/string/capitalize.ts","../../src/string/_internal/getWords.ts","../../src/string/camelCase.ts","../../src/string/snakeCase.ts","../../src/string/kebabCase.ts","../../src/string/lowerCase.ts","../../src/string/startCase.ts","../../src/string/startsWith.ts","../../src/string/endsWith.ts"],"sourcesContent":["export { camelCase } from './camelCase.ts';\nexport { snakeCase } from './snakeCase.ts';\nexport { kebabCase } from './kebabCase.ts';\nexport { lowerCase } from './lowerCase.ts';\nexport { startCase } from './startCase.ts';\nexport { startsWith } from './startsWith.ts';\nexport { endsWith } from './endsWith.ts';\nexport { capitalize } from './capitalize.ts';\n","/**\n * Converts the first character of string to upper case and the remaining to lower case.\n *\n * @template T - Literal type of the string.\n * @param {T} str - The string to be converted to uppercase.\n * @returns {Capitalize<T>} - The capitalized string.\n *\n * @example\n * const result = capitalize('fred') // returns 'Fred'\n * const result2 = capitalize('FRED') // returns 'Fred'\n */\n\nexport const capitalize = <T extends string>(str: T): Capitalize<T> => {\n return (str.charAt(0).toUpperCase() + str.slice(1).toLowerCase()) as Capitalize<T>;\n};\n","/**\n * Regular expression pattern to split strings into words for various case conversions\n *\n * This pattern matchs sequences of characters in a string, considering the following case:\n * - Sequences of two or more uppercase letters followed by an uppercase letter and lowercase letters or digits (for acronyms)\n * - Sequences of one uppercase letter optionally followed by lowercase letters and digits\n * - Single uppercase letters\n * - Sequences of digis\n *\n * The resulting match can be used to convert camelCase, snake_case, kebab-case, and other mixed formats into\n * a consistent format like snake case.\n *\n * @example\n * const matches = 'camelCaseHTTPRequest'.match(CASE_SPLIT_PATTERN);\n * // matchs: ['camel', 'Case', 'HTTP', 'Request']\n */\nconst CASE_SPLIT_PATTERN = /[A-Z]?[a-z]+|[0-9]+|[A-Z]+(?![a-z])/g;\n\nexport function getWords(str: string): string[] {\n return Array.from(str.match(CASE_SPLIT_PATTERN) ?? []);\n}\n","import { capitalize } from \"./capitalize.ts\";\nimport { getWords } from \"./_internal/getWords.ts\";\n\n/**\n * Converts a string to camel case.\n *\n * camel case is the naming convention in which each word is written in lowercase and separated by an underscore (_) character.\n *\n * @param {string} str - The string that is to be changed to camel case.\n * @returns {string} - The converted string to camel case.\n *\n * @example\n * const convertedStr1 = camelCase('camelCase') // returns 'camelCase'\n * const convertedStr2 = camelCase('some whitespace') // returns 'someWhitespace'\n * const convertedStr3 = camelCase('hyphen-text') // returns 'hyphenText'\n * const convertedStr4 = camelCase('HTTPRequest') // returns 'httpRequest'\n */\n\nexport function camelCase(str: string): string {\n const words = getWords(str);\n\n if (words.length === 0) {\n return \"\";\n }\n\n const [first, ...rest] = words;\n\n return `${first.toLowerCase()}${rest.map((word) => capitalize(word)).join(\"\")\n }`;\n}\n","import { getWords } from './_internal/getWords.ts';\n\n/**\n * Converts a string to snake case.\n *\n * Snake case is the naming convention in which each word is written in lowercase and separated by an underscore (_) character.\n *\n * @param {string} str - The string that is to be changed to snake case.\n * @returns {string} - The converted string to snake case.\n *\n * @example\n * const convertedStr1 = snakeCase('camelCase') // returns 'camel_case'\n * const convertedStr2 = snakeCase('some whitespace') // returns 'some_whitespace'\n * const convertedStr3 = snakeCase('hyphen-text') // returns 'hyphen_text'\n * const convertedStr4 = snakeCase('HTTPRequest') // returns 'http_request'\n */\n\nexport const snakeCase = (str: string): string => {\n const words = getWords(str);\n return words.map(word => word.toLowerCase()).join('_');\n};\n","import { getWords } from './_internal/getWords.ts';\n\n/**\n * Converts a string to kebab case.\n *\n * Kebab case is the naming convention in which each word is written in lowercase and separated by a dash (-) character.\n *\n * @param {string} str - The string that is to be changed to kebab case.\n * @returns {string} - The converted string to kebab case.\n *\n * @example\n * const convertedStr1 = kebabCase('camelCase') // returns 'camel-case'\n * const convertedStr2 = kebabCase('some whitespace') // returns 'some-whitespace'\n * const convertedStr3 = kebabCase('hyphen-text') // returns 'hyphen-text'\n * const convertedStr4 = kebabCase('HTTPRequest') // returns 'http-request'\n */\n\nexport const kebabCase = (str: string): string => {\n const words = getWords(str);\n return words.map(word => word.toLowerCase()).join('-');\n};\n","import { getWords } from './_internal/getWords.ts';\n\n/**\n * Converts a string to lower case.\n *\n * Lower case is the naming convention in which each word is written in lowercase and separated by an space ( ) character.\n *\n * @param {string} str - The string that is to be changed to lower case.\n * @returns {string} - The converted string to lower case.\n *\n * @example\n * const convertedStr1 = lowerCase('camelCase') // returns 'camel case'\n * const convertedStr2 = lowerCase('some whitespace') // returns 'some whitespace'\n * const convertedStr3 = lowerCase('hyphen-text') // returns 'hyphen text'\n * const convertedStr4 = lowerCase('HTTPRequest') // returns 'http request'\n */\nexport const lowerCase = (str: string): string => {\n const words = getWords(str);\n return words.map(word => word.toLowerCase()).join(' ');\n};\n","import { getWords } from './_internal/getWords.ts';\n\n/**\n * Converts the first character of each word in a string to uppercase and the remaining characters to lowercase.\n *\n * Start case is the naming convention in which each word is written with an initial capital letter.\n * @param {string} str - The string to convert.\n * @returns {string} The converted string.\n *\n * @example\n * const result1 = startCase('hello world'); // result will be 'Hello World'\n * const result2 = startCase('HELLO WORLD'); // result will be 'Hello World'\n * const result3 = startCase('hello-world'); // result will be 'Hello World'\n * const result4 = startCase('hello_world'); // result will be 'Hello World'\n */\nexport function startCase(str: string): string {\n const words = getWords(str.trim());\n let result = '';\n for (const word of words) {\n if (result) {\n result += ' ';\n }\n if (word === word.toUpperCase()) {\n result += word;\n } else {\n result += word[0].toUpperCase() + word.slice(1).toLowerCase();\n }\n }\n return result;\n}\n","/**\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","/**\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":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACYO,IAAM,aAAa,CAAmB,QAA0B;AACrE,SAAQ,IAAI,OAAO,CAAC,EAAE,YAAY,IAAI,IAAI,MAAM,CAAC,EAAE,YAAY;AACjE;;;ACEA,IAAM,qBAAqB;AAEpB,SAAS,SAAS,KAAuB;AAlBhD;AAmBE,SAAO,MAAM,MAAK,SAAI,MAAM,kBAAkB,MAA5B,YAAiC,CAAC,CAAC;AACvD;;;ACFO,SAAS,UAAU,KAAqB;AAC7C,QAAM,QAAQ,SAAS,GAAG;AAE1B,MAAI,MAAM,WAAW,GAAG;AACtB,WAAO;AAAA,EACT;AAEA,QAAM,CAAC,OAAO,GAAG,IAAI,IAAI;AAEzB,SAAO,GAAG,MAAM,YAAY,CAAC,GAAG,KAAK,IAAI,CAAC,SAAS,WAAW,IAAI,CAAC,EAAE,KAAK,EAAE,CAC1E;AACJ;;;ACZO,IAAM,YAAY,CAAC,QAAwB;AAChD,QAAM,QAAQ,SAAS,GAAG;AAC1B,SAAO,MAAM,IAAI,UAAQ,KAAK,YAAY,CAAC,EAAE,KAAK,GAAG;AACvD;;;ACHO,IAAM,YAAY,CAAC,QAAwB;AAChD,QAAM,QAAQ,SAAS,GAAG;AAC1B,SAAO,MAAM,IAAI,UAAQ,KAAK,YAAY,CAAC,EAAE,KAAK,GAAG;AACvD;;;ACJO,IAAM,YAAY,CAAC,QAAwB;AAChD,QAAM,QAAQ,SAAS,GAAG;AAC1B,SAAO,MAAM,IAAI,UAAQ,KAAK,YAAY,CAAC,EAAE,KAAK,GAAG;AACvD;;;ACJO,SAAS,UAAU,KAAqB;AAC7C,QAAM,QAAQ,SAAS,IAAI,KAAK,CAAC;AACjC,MAAI,SAAS;AACb,aAAW,QAAQ,OAAO;AACxB,QAAI,QAAQ;AACV,gBAAU;AAAA,IACZ;AACA,QAAI,SAAS,KAAK,YAAY,GAAG;AAC/B,gBAAU;AAAA,IACZ,OAAO;AACL,gBAAU,KAAK,CAAC,EAAE,YAAY,IAAI,KAAK,MAAM,CAAC,EAAE,YAAY;AAAA,IAC9D;AAAA,EACF;AACA,SAAO;AACT;;;ACZO,IAAM,aAAa,CAAC,KAAa,QAAgB,WAAmB,MAAe;AACxF,SAAO,IAAI,WAAW,QAAQ,QAAQ;AACxC;;;ACFO,IAAM,WAAW,CAAC,KAAa,QAAgB,WAAmB,IAAI,WAAoB;AAC/F,SAAO,IAAI,SAAS,QAAQ,QAAQ;AACtC;","names":[]}
1
+ {"version":3,"sources":["../../src/string/index.ts","../../src/string/capitalize.ts","../../src/string/_internal/getWords.ts","../../src/string/camelCase.ts","../../src/string/snakeCase.ts","../../src/string/kebabCase.ts","../../src/string/lowerCase.ts","../../src/string/startCase.ts"],"sourcesContent":["export { camelCase } from './camelCase.ts';\nexport { snakeCase } from './snakeCase.ts';\nexport { kebabCase } from './kebabCase.ts';\nexport { lowerCase } from './lowerCase.ts';\nexport { startCase } from './startCase.ts';\nexport { capitalize } from './capitalize.ts';\n","/**\n * Converts the first character of string to upper case and the remaining to lower case.\n *\n * @template T - Literal type of the string.\n * @param {T} str - The string to be converted to uppercase.\n * @returns {Capitalize<T>} - The capitalized string.\n *\n * @example\n * const result = capitalize('fred') // returns 'Fred'\n * const result2 = capitalize('FRED') // returns 'Fred'\n */\n\nexport const capitalize = <T extends string>(str: T): Capitalize<T> => {\n return (str.charAt(0).toUpperCase() + str.slice(1).toLowerCase()) as Capitalize<T>;\n};\n","/**\n * Regular expression pattern to split strings into words for various case conversions\n *\n * This pattern matchs sequences of characters in a string, considering the following case:\n * - Sequences of two or more uppercase letters followed by an uppercase letter and lowercase letters or digits (for acronyms)\n * - Sequences of one uppercase letter optionally followed by lowercase letters and digits\n * - Single uppercase letters\n * - Sequences of digis\n *\n * The resulting match can be used to convert camelCase, snake_case, kebab-case, and other mixed formats into\n * a consistent format like snake case.\n *\n * @example\n * const matches = 'camelCaseHTTPRequest'.match(CASE_SPLIT_PATTERN);\n * // matchs: ['camel', 'Case', 'HTTP', 'Request']\n */\nconst CASE_SPLIT_PATTERN = /[A-Z]?[a-z]+|[0-9]+|[A-Z]+(?![a-z])/g;\n\nexport function getWords(str: string): string[] {\n return Array.from(str.match(CASE_SPLIT_PATTERN) ?? []);\n}\n","import { capitalize } from \"./capitalize.ts\";\nimport { getWords } from \"./_internal/getWords.ts\";\n\n/**\n * Converts a string to camel case.\n *\n * camel case is the naming convention in which each word is written in lowercase and separated by an underscore (_) character.\n *\n * @param {string} str - The string that is to be changed to camel case.\n * @returns {string} - The converted string to camel case.\n *\n * @example\n * const convertedStr1 = camelCase('camelCase') // returns 'camelCase'\n * const convertedStr2 = camelCase('some whitespace') // returns 'someWhitespace'\n * const convertedStr3 = camelCase('hyphen-text') // returns 'hyphenText'\n * const convertedStr4 = camelCase('HTTPRequest') // returns 'httpRequest'\n */\n\nexport function camelCase(str: string): string {\n const words = getWords(str);\n\n if (words.length === 0) {\n return \"\";\n }\n\n const [first, ...rest] = words;\n\n return `${first.toLowerCase()}${rest.map((word) => capitalize(word)).join(\"\")\n }`;\n}\n","import { getWords } from './_internal/getWords.ts';\n\n/**\n * Converts a string to snake case.\n *\n * Snake case is the naming convention in which each word is written in lowercase and separated by an underscore (_) character.\n *\n * @param {string} str - The string that is to be changed to snake case.\n * @returns {string} - The converted string to snake case.\n *\n * @example\n * const convertedStr1 = snakeCase('camelCase') // returns 'camel_case'\n * const convertedStr2 = snakeCase('some whitespace') // returns 'some_whitespace'\n * const convertedStr3 = snakeCase('hyphen-text') // returns 'hyphen_text'\n * const convertedStr4 = snakeCase('HTTPRequest') // returns 'http_request'\n */\n\nexport const snakeCase = (str: string): string => {\n const words = getWords(str);\n return words.map(word => word.toLowerCase()).join('_');\n};\n","import { getWords } from './_internal/getWords.ts';\n\n/**\n * Converts a string to kebab case.\n *\n * Kebab case is the naming convention in which each word is written in lowercase and separated by a dash (-) character.\n *\n * @param {string} str - The string that is to be changed to kebab case.\n * @returns {string} - The converted string to kebab case.\n *\n * @example\n * const convertedStr1 = kebabCase('camelCase') // returns 'camel-case'\n * const convertedStr2 = kebabCase('some whitespace') // returns 'some-whitespace'\n * const convertedStr3 = kebabCase('hyphen-text') // returns 'hyphen-text'\n * const convertedStr4 = kebabCase('HTTPRequest') // returns 'http-request'\n */\n\nexport const kebabCase = (str: string): string => {\n const words = getWords(str);\n return words.map(word => word.toLowerCase()).join('-');\n};\n","import { getWords } from './_internal/getWords.ts';\n\n/**\n * Converts a string to lower case.\n *\n * Lower case is the naming convention in which each word is written in lowercase and separated by an space ( ) character.\n *\n * @param {string} str - The string that is to be changed to lower case.\n * @returns {string} - The converted string to lower case.\n *\n * @example\n * const convertedStr1 = lowerCase('camelCase') // returns 'camel case'\n * const convertedStr2 = lowerCase('some whitespace') // returns 'some whitespace'\n * const convertedStr3 = lowerCase('hyphen-text') // returns 'hyphen text'\n * const convertedStr4 = lowerCase('HTTPRequest') // returns 'http request'\n */\nexport const lowerCase = (str: string): string => {\n const words = getWords(str);\n return words.map(word => word.toLowerCase()).join(' ');\n};\n","import { getWords } from './_internal/getWords.ts';\n\n/**\n * Converts the first character of each word in a string to uppercase and the remaining characters to lowercase.\n *\n * Start case is the naming convention in which each word is written with an initial capital letter.\n * @param {string} str - The string to convert.\n * @returns {string} The converted string.\n *\n * @example\n * const result1 = startCase('hello world'); // result will be 'Hello World'\n * const result2 = startCase('HELLO WORLD'); // result will be 'Hello World'\n * const result3 = startCase('hello-world'); // result will be 'Hello World'\n * const result4 = startCase('hello_world'); // result will be 'Hello World'\n */\nexport function startCase(str: string): string {\n const words = getWords(str.trim());\n let result = '';\n for (const word of words) {\n if (result) {\n result += ' ';\n }\n if (word === word.toUpperCase()) {\n result += word;\n } else {\n result += word[0].toUpperCase() + word.slice(1).toLowerCase();\n }\n }\n return result;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACYO,IAAM,aAAa,CAAmB,QAA0B;AACrE,SAAQ,IAAI,OAAO,CAAC,EAAE,YAAY,IAAI,IAAI,MAAM,CAAC,EAAE,YAAY;AACjE;;;ACEA,IAAM,qBAAqB;AAEpB,SAAS,SAAS,KAAuB;AAlBhD;AAmBE,SAAO,MAAM,MAAK,SAAI,MAAM,kBAAkB,MAA5B,YAAiC,CAAC,CAAC;AACvD;;;ACFO,SAAS,UAAU,KAAqB;AAC7C,QAAM,QAAQ,SAAS,GAAG;AAE1B,MAAI,MAAM,WAAW,GAAG;AACtB,WAAO;AAAA,EACT;AAEA,QAAM,CAAC,OAAO,GAAG,IAAI,IAAI;AAEzB,SAAO,GAAG,MAAM,YAAY,CAAC,GAAG,KAAK,IAAI,CAAC,SAAS,WAAW,IAAI,CAAC,EAAE,KAAK,EAAE,CAC1E;AACJ;;;ACZO,IAAM,YAAY,CAAC,QAAwB;AAChD,QAAM,QAAQ,SAAS,GAAG;AAC1B,SAAO,MAAM,IAAI,UAAQ,KAAK,YAAY,CAAC,EAAE,KAAK,GAAG;AACvD;;;ACHO,IAAM,YAAY,CAAC,QAAwB;AAChD,QAAM,QAAQ,SAAS,GAAG;AAC1B,SAAO,MAAM,IAAI,UAAQ,KAAK,YAAY,CAAC,EAAE,KAAK,GAAG;AACvD;;;ACJO,IAAM,YAAY,CAAC,QAAwB;AAChD,QAAM,QAAQ,SAAS,GAAG;AAC1B,SAAO,MAAM,IAAI,UAAQ,KAAK,YAAY,CAAC,EAAE,KAAK,GAAG;AACvD;;;ACJO,SAAS,UAAU,KAAqB;AAC7C,QAAM,QAAQ,SAAS,IAAI,KAAK,CAAC;AACjC,MAAI,SAAS;AACb,aAAW,QAAQ,OAAO;AACxB,QAAI,QAAQ;AACV,gBAAU;AAAA,IACZ;AACA,QAAI,SAAS,KAAK,YAAY,GAAG;AAC/B,gBAAU;AAAA,IACZ,OAAO;AACL,gBAAU,KAAK,CAAC,EAAE,YAAY,IAAI,KAAK,MAAM,CAAC,EAAE,YAAY;AAAA,IAC9D;AAAA,EACF;AACA,SAAO;AACT;","names":[]}
@@ -1,19 +1,10 @@
1
- import "../chunk-YCTGSM4S.mjs";
2
- import {
3
- startCase
4
- } from "../chunk-QXTNZR7B.mjs";
5
- import {
6
- startsWith
7
- } from "../chunk-SR5RPVRM.mjs";
1
+ import "../chunk-XT74R35S.mjs";
8
2
  import {
9
3
  camelCase
10
4
  } from "../chunk-Y5V7UAZZ.mjs";
11
5
  import {
12
6
  capitalize
13
7
  } from "../chunk-U56ZOM7L.mjs";
14
- import {
15
- endsWith
16
- } from "../chunk-ZFRI6VS4.mjs";
17
8
  import {
18
9
  kebabCase
19
10
  } from "../chunk-EYYZQFOP.mjs";
@@ -23,16 +14,17 @@ import {
23
14
  import {
24
15
  snakeCase
25
16
  } from "../chunk-F3WCQQET.mjs";
17
+ import {
18
+ startCase
19
+ } from "../chunk-QXTNZR7B.mjs";
26
20
  import "../chunk-WVQ7YVRK.mjs";
27
21
  import "../chunk-2MM5EJJX.mjs";
28
22
  export {
29
23
  camelCase,
30
24
  capitalize,
31
- endsWith,
32
25
  kebabCase,
33
26
  lowerCase,
34
27
  snakeCase,
35
- startCase,
36
- startsWith
28
+ startCase
37
29
  };
38
30
  //# sourceMappingURL=index.mjs.map
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "es-toolkit",
3
3
  "description": "A state-of-the-art, high-performance JavaScript utility library with a small bundle size and strong type annotations.",
4
- "version": "1.10.1-dev.250+b9b409db",
4
+ "version": "1.10.1-dev.251+2db0b495",
5
5
  "homepage": "https://es-toolkit.slash.page",
6
6
  "bugs": "https://github.com/toss/es-toolkit/issues",
7
7
  "repository": {
@@ -1,9 +0,0 @@
1
- // src/string/startsWith.ts
2
- var startsWith = (str, target, position = 0) => {
3
- return str.startsWith(target, position);
4
- };
5
-
6
- export {
7
- startsWith
8
- };
9
- //# sourceMappingURL=chunk-SR5RPVRM.mjs.map
@@ -1 +0,0 @@
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":[]}
@@ -1 +0,0 @@
1
- //# sourceMappingURL=chunk-YCTGSM4S.mjs.map
@@ -1,9 +0,0 @@
1
- // src/string/endsWith.ts
2
- var endsWith = (str, target, position = str.length) => {
3
- return str.endsWith(target, position);
4
- };
5
-
6
- export {
7
- endsWith
8
- };
9
- //# sourceMappingURL=chunk-ZFRI6VS4.mjs.map
@@ -1 +0,0 @@
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":[]}
@@ -1,20 +0,0 @@
1
- /**
2
- * Checks if a string contains another string at the end of the string.
3
- *
4
- * Checks if one string endsWith another string. Optional position parameter to offset searching before a certain index.
5
- *
6
- * @param {string} str - The string that might contain the target string.
7
- * @param {string} target - The string to search for.
8
- * @param {number} position - An optional position from the start to search up to this index
9
- * @returns {boolean} - True if the str string ends with the target string.
10
- *
11
- * @example
12
- * const isPrefix = endsWith('fooBar', 'foo') // returns true
13
- * const isPrefix = endsWith('fooBar', 'bar') // returns false
14
- * const isPrefix = endsWith('fooBar', 'abc') // returns false
15
- * const isPrefix = endsWith('fooBar', 'foo', 3) // returns true
16
- * const isPrefix = endsWith('fooBar', 'abc', 5) // returns false
17
- */
18
- declare const endsWith: (str: string, target: string, position?: number) => boolean;
19
-
20
- export { endsWith };
@@ -1,20 +0,0 @@
1
- /**
2
- * Checks if a string contains another string at the end of the string.
3
- *
4
- * Checks if one string endsWith another string. Optional position parameter to offset searching before a certain index.
5
- *
6
- * @param {string} str - The string that might contain the target string.
7
- * @param {string} target - The string to search for.
8
- * @param {number} position - An optional position from the start to search up to this index
9
- * @returns {boolean} - True if the str string ends with the target string.
10
- *
11
- * @example
12
- * const isPrefix = endsWith('fooBar', 'foo') // returns true
13
- * const isPrefix = endsWith('fooBar', 'bar') // returns false
14
- * const isPrefix = endsWith('fooBar', 'abc') // returns false
15
- * const isPrefix = endsWith('fooBar', 'foo', 3) // returns true
16
- * const isPrefix = endsWith('fooBar', 'abc', 5) // returns false
17
- */
18
- declare const endsWith: (str: string, target: string, position?: number) => boolean;
19
-
20
- export { endsWith };
@@ -1,33 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/string/endsWith.ts
21
- var endsWith_exports = {};
22
- __export(endsWith_exports, {
23
- endsWith: () => endsWith
24
- });
25
- module.exports = __toCommonJS(endsWith_exports);
26
- var endsWith = (str, target, position = str.length) => {
27
- return str.endsWith(target, position);
28
- };
29
- // Annotate the CommonJS export names for ESM import in node:
30
- 0 && (module.exports = {
31
- endsWith
32
- });
33
- //# sourceMappingURL=endsWith.js.map
@@ -1 +0,0 @@
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":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAiBO,IAAM,WAAW,CAAC,KAAa,QAAgB,WAAmB,IAAI,WAAoB;AAC/F,SAAO,IAAI,SAAS,QAAQ,QAAQ;AACtC;","names":[]}
@@ -1,8 +0,0 @@
1
- import {
2
- endsWith
3
- } from "../chunk-ZFRI6VS4.mjs";
4
- import "../chunk-2MM5EJJX.mjs";
5
- export {
6
- endsWith
7
- };
8
- //# sourceMappingURL=endsWith.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,20 +0,0 @@
1
- /**
2
- * Checks if a string contains another string at the beginning of the string.
3
- *
4
- * Checks if one string startsWith another string. Optional position parameter to start searching from a certain index.
5
- *
6
- * @param {string} str - The string that might contain the target string.
7
- * @param {string} target - The string to search for.
8
- * @param {number} position - An optional offset to start searching in the str string
9
- * @returns {boolean} - True if the str string starts with the target string.
10
- *
11
- * @example
12
- * const isPrefix = startsWith('fooBar', 'foo') // returns true
13
- * const isPrefix = startsWith('fooBar', 'bar') // returns false
14
- * const isPrefix = startsWith('fooBar', 'abc') // returns false
15
- * const isPrefix = startsWith('fooBar', 'Bar', 2) // returns true
16
- * const isPrefix = startsWith('fooBar', 'Bar', 5) // returns false
17
- */
18
- declare const startsWith: (str: string, target: string, position?: number) => boolean;
19
-
20
- export { startsWith };
@@ -1,20 +0,0 @@
1
- /**
2
- * Checks if a string contains another string at the beginning of the string.
3
- *
4
- * Checks if one string startsWith another string. Optional position parameter to start searching from a certain index.
5
- *
6
- * @param {string} str - The string that might contain the target string.
7
- * @param {string} target - The string to search for.
8
- * @param {number} position - An optional offset to start searching in the str string
9
- * @returns {boolean} - True if the str string starts with the target string.
10
- *
11
- * @example
12
- * const isPrefix = startsWith('fooBar', 'foo') // returns true
13
- * const isPrefix = startsWith('fooBar', 'bar') // returns false
14
- * const isPrefix = startsWith('fooBar', 'abc') // returns false
15
- * const isPrefix = startsWith('fooBar', 'Bar', 2) // returns true
16
- * const isPrefix = startsWith('fooBar', 'Bar', 5) // returns false
17
- */
18
- declare const startsWith: (str: string, target: string, position?: number) => boolean;
19
-
20
- export { startsWith };
@@ -1,33 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/string/startsWith.ts
21
- var startsWith_exports = {};
22
- __export(startsWith_exports, {
23
- startsWith: () => startsWith
24
- });
25
- module.exports = __toCommonJS(startsWith_exports);
26
- var startsWith = (str, target, position = 0) => {
27
- return str.startsWith(target, position);
28
- };
29
- // Annotate the CommonJS export names for ESM import in node:
30
- 0 && (module.exports = {
31
- startsWith
32
- });
33
- //# sourceMappingURL=startsWith.js.map
@@ -1 +0,0 @@
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":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAiBO,IAAM,aAAa,CAAC,KAAa,QAAgB,WAAmB,MAAe;AACxF,SAAO,IAAI,WAAW,QAAQ,QAAQ;AACxC;","names":[]}
@@ -1,8 +0,0 @@
1
- import {
2
- startsWith
3
- } from "../chunk-SR5RPVRM.mjs";
4
- import "../chunk-2MM5EJJX.mjs";
5
- export {
6
- startsWith
7
- };
8
- //# sourceMappingURL=startsWith.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}