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
package/dist/compat/index.mjs
CHANGED
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
import "../chunk-NKLIE2OI.mjs";
|
|
2
2
|
import "../chunk-ARZ5BDR6.mjs";
|
|
3
|
-
import "../chunk-
|
|
3
|
+
import "../chunk-YCTGSM4S.mjs";
|
|
4
|
+
import {
|
|
5
|
+
startCase
|
|
6
|
+
} from "../chunk-QXTNZR7B.mjs";
|
|
7
|
+
import {
|
|
8
|
+
startsWith
|
|
9
|
+
} from "../chunk-SR5RPVRM.mjs";
|
|
4
10
|
import {
|
|
5
11
|
camelCase
|
|
6
12
|
} from "../chunk-Y5V7UAZZ.mjs";
|
|
7
13
|
import {
|
|
8
14
|
capitalize
|
|
9
15
|
} from "../chunk-U56ZOM7L.mjs";
|
|
16
|
+
import {
|
|
17
|
+
endsWith
|
|
18
|
+
} from "../chunk-ZFRI6VS4.mjs";
|
|
10
19
|
import {
|
|
11
20
|
kebabCase
|
|
12
21
|
} from "../chunk-EYYZQFOP.mjs";
|
|
@@ -16,9 +25,6 @@ import {
|
|
|
16
25
|
import {
|
|
17
26
|
snakeCase
|
|
18
27
|
} from "../chunk-F3WCQQET.mjs";
|
|
19
|
-
import {
|
|
20
|
-
startCase
|
|
21
|
-
} from "../chunk-QXTNZR7B.mjs";
|
|
22
28
|
import "../chunk-WVQ7YVRK.mjs";
|
|
23
29
|
import "../chunk-ASJF5D6C.mjs";
|
|
24
30
|
import {
|
|
@@ -365,6 +371,7 @@ export {
|
|
|
365
371
|
dropRight,
|
|
366
372
|
dropRightWhile,
|
|
367
373
|
dropWhile,
|
|
374
|
+
endsWith,
|
|
368
375
|
fill,
|
|
369
376
|
flatMap,
|
|
370
377
|
flatten,
|
|
@@ -411,6 +418,7 @@ export {
|
|
|
411
418
|
shuffle,
|
|
412
419
|
snakeCase,
|
|
413
420
|
startCase,
|
|
421
|
+
startsWith,
|
|
414
422
|
sum,
|
|
415
423
|
sumBy,
|
|
416
424
|
tail,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/compat/array/chunk.ts","../../src/compat/_internal/isIndex.ts","../../src/compat/_internal/toPath.ts","../../src/compat/object/set.ts","../../src/compat/array/zipObjectDeep.ts"],"sourcesContent":["import { chunk as chunkToolkit } from '../../array/chunk.ts';\n\n/**\n * Splits an array into smaller arrays of a specified length.\n *\n * This function takes an input array and divides it into multiple smaller arrays,\n * each of a specified length. If the input array cannot be evenly divided,\n * the final sub-array will contain the remaining elements.\n *\n * @template T The type of elements in the array.\n * @param {T[]} arr - The array to be chunked into smaller arrays.\n * @param {number} size - The size of each smaller array. Must be a positive integer.\n * @returns {T[][]} A two-dimensional array where each sub-array has a maximum length of `size`.\n * @throws {Error} Throws an error if `size` is not a positive integer.\n *\n * @example\n * // Splits an array of numbers into sub-arrays of length 2\n * chunk([1, 2, 3, 4, 5], 2);\n * // Returns: [[1, 2], [3, 4], [5]]\n *\n * @example\n * // Splits an array of strings into sub-arrays of length 3\n * chunk(['a', 'b', 'c', 'd', 'e', 'f', 'g'], 3);\n * // Returns: [['a', 'b', 'c'], ['d', 'e', 'f'], ['g']]\n */\nexport function chunk<T>(arr: readonly T[], size: number = 1): T[][] {\n size = Math.max(Math.floor(size), 0);\n\n if (size === 0) {\n return [];\n }\n\n return chunkToolkit(arr, size);\n}\n","const IS_UNSIGNED_INTEGER = /^(?:0|[1-9]\\d*)$/\n\nexport function isIndex(value: PropertyKey) {\n switch (typeof value) {\n case 'number': {\n return Number.isInteger(value) && value >= 0 && value < Number.MAX_SAFE_INTEGER;\n }\n case 'symbol': {\n return false;\n }\n case 'string': {\n return IS_UNSIGNED_INTEGER.test(value);\n }\n }\n}","const ESCAPE_REGEXP = /\\\\(\\\\)?/g;\nconst PROPERTY_REGEXP = RegExp(\n // Match anything that isn't a dot or bracket.\n \"[^.[\\\\]]+\" +\n \"|\" +\n // Or match property names within brackets.\n \"\\\\[(?:\" +\n // Match a non-string expression.\n \"([^\\\"'][^[]*)\" +\n \"|\" +\n // Or match strings (supports escaping characters).\n \"([\\\"'])((?:(?!\\\\2)[^\\\\\\\\]|\\\\\\\\.)*?)\\\\2\" +\n \")\\\\]\" +\n \"|\" +\n // Or match \"\" as the space between consecutive dots or empty brackets.\n \"(?=(?:\\\\.|\\\\[\\\\])(?:\\\\.|\\\\[\\\\]|$))\",\n \"g\",\n);\n\n/**\n * Converts a deep key string into an array of path segments.\n *\n * This function takes a string representing a deep key (e.g., 'a.b.c' or 'a[b][c]') and breaks it down into an array of strings, each representing a segment of the path.\n *\n * @param deepKey - The deep key string to convert.\n * @returns An array of strings, each representing a segment of the path.\n *\n * Examples:\n *\n * toPath('a.b.c') // Returns ['a', 'b', 'c']\n * toPath('a[b][c]') // Returns ['a', 'b', 'c']\n * toPath('.a.b.c') // Returns ['', 'a', 'b', 'c']\n * toPath('a[\"b.c\"].d') // Returns ['a', 'b.c', 'd']\n * toPath('') // Returns []\n * toPath('.a[b].c.d[e][\"f.g\"].h') // Returns ['', 'a', 'b', 'c', 'd', 'e', 'f.g', 'h']\n */\nexport function toPath(deepKey: string): string[] {\n const result: string[] = [];\n\n if (deepKey[0] === \".\") {\n result.push(\"\");\n }\n\n let match: RegExpExecArray | null;\n\n while ((match = PROPERTY_REGEXP.exec(deepKey)) !== null) {\n let [key, expr, quote, substr] = match;\n\n if (quote) {\n key = substr.replace(ESCAPE_REGEXP, \"$1\");\n } else if (expr) {\n key = expr.trim();\n }\n\n result.push(key);\n }\n\n return result;\n}\n","import { isIndex } from \"../_internal/isIndex.ts\";\nimport { toPath } from \"../_internal/toPath.ts\";\n\n/**\n * Sets the value at the specified path of the given object. If any part of the path does not exist, it will be created.\n *\n * @template T - The type of the object.\n * @param {Settable} obj - The object to modify.\n * @param {Path} path - The path of the property to set.\n * @param {any} value - The value to set.\n * @returns {T} - The modified object.\n *\n * @example\n * // Set a value in a nested object\n * const obj = { a: { b: { c: 3 } } };\n * set(obj, 'a.b.c', 4);\n * console.log(obj.a.b.c); // 4\n *\n * @example\n * // Set a value in an array\n * const arr = [1, 2, 3];\n * set(arr, 1, 4);\n * console.log(arr[1]); // 4\n *\n * @example\n * // Create non-existent path and set value\n * const obj = {};\n * set(obj, 'a.b.c', 4);\n * console.log(obj); // { a: { b: { c: 4 } } }\n */\nexport function set<T>(obj: object, path: PropertyKey | readonly PropertyKey[], value: unknown): T;\nexport function set<T extends object>(obj: T, path: PropertyKey | readonly PropertyKey[], value: unknown): T {\n const resolvedPath = Array.isArray(path)\n ? path\n : typeof path === 'string'\n ? toPath(path)\n : [path];\n\n let current: any = obj;\n\n for (let i = 0; i < resolvedPath.length - 1; i++) {\n const key = resolvedPath[i];\n const nextKey = resolvedPath[i + 1];\n\n if (current[key] == null) {\n current[key] = isIndex(nextKey) ? [] : {};\n }\n\n current = current[key];\n }\n\n const lastKey = resolvedPath[resolvedPath.length - 1];\n current[lastKey] = value;\n\n return obj;\n}\n","import { zip } from \"../../array/zip.ts\";\nimport { set } from \"../object/set.ts\";\n\n/**\n * Creates a deeply nested object given arrays of paths and values.\n *\n * This function takes two arrays: one containing arrays of property paths, and the other containing corresponding values.\n * It returns a new object where paths from the first array are used as key paths to set values, with corresponding elements from the second array as values.\n * Paths can be dot-separated strings or arrays of property names.\n * \n * If the `keys` array is longer than the `values` array, the remaining keys will have `undefined` as their values.\n *\n * @template V - The type of elements in the array.\n * @param {string[] | string[][]} keys - An array of property paths, each path can be a dot-separated string or an array of property names.\n * @param {V[]} values - An array of values corresponding to the property paths.\n * @returns {object} A new object composed of the given property paths and values.\n *\n * @example\n * const paths = ['a.b.c', 'd.e.f'];\n * const values = [1, 2];\n * const result = zipObjectDeep(paths, values);\n * // result will be { a: { b: { c: 1 } }, d: { e: { f: 2 } } }\n *\n * @example\n * const paths = [['a', 'b', 'c'], ['d', 'e', 'f']];\n * const values = [1, 2];\n * const result = zipObjectDeep(paths, values);\n * // result will be { a: { b: { c: 1 } }, d: { e: { f: 2 } } }\n * \n * @example\n * const paths = ['a.b[0].c', 'a.b[1].d'];\n * const values = [1, 2];\n * const result = zipObjectDeep(paths, values);\n * // result will be { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }\n */\nexport function zipObjectDeep<P extends string | number | symbol, V>(keys: P[], values: V[]): { [K in P]: V } {\n const result = {} as { [K in P]: V };\n const zipped = zip(keys, values);\n\n for (let i = 0; i < zipped.length; i++) {\n const [key, value] = zipped[i];\n\n if (key != null) {\n set(result, key, value);\n }\n }\n\n return result;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/compat/array/chunk.ts","../../src/compat/_internal/isIndex.ts","../../src/compat/_internal/toPath.ts","../../src/compat/object/set.ts","../../src/compat/array/zipObjectDeep.ts"],"sourcesContent":["import { chunk as chunkToolkit } from '../../array/chunk.ts';\n\n/**\n * Splits an array into smaller arrays of a specified length.\n *\n * This function takes an input array and divides it into multiple smaller arrays,\n * each of a specified length. If the input array cannot be evenly divided,\n * the final sub-array will contain the remaining elements.\n *\n * @template T The type of elements in the array.\n * @param {T[]} arr - The array to be chunked into smaller arrays.\n * @param {number} size - The size of each smaller array. Must be a positive integer.\n * @returns {T[][]} A two-dimensional array where each sub-array has a maximum length of `size`.\n * @throws {Error} Throws an error if `size` is not a positive integer.\n *\n * @example\n * // Splits an array of numbers into sub-arrays of length 2\n * chunk([1, 2, 3, 4, 5], 2);\n * // Returns: [[1, 2], [3, 4], [5]]\n *\n * @example\n * // Splits an array of strings into sub-arrays of length 3\n * chunk(['a', 'b', 'c', 'd', 'e', 'f', 'g'], 3);\n * // Returns: [['a', 'b', 'c'], ['d', 'e', 'f'], ['g']]\n */\nexport function chunk<T>(arr: readonly T[], size: number = 1): T[][] {\n size = Math.max(Math.floor(size), 0);\n\n if (size === 0) {\n return [];\n }\n\n return chunkToolkit(arr, size);\n}\n","const IS_UNSIGNED_INTEGER = /^(?:0|[1-9]\\d*)$/\n\nexport function isIndex(value: PropertyKey) {\n switch (typeof value) {\n case 'number': {\n return Number.isInteger(value) && value >= 0 && value < Number.MAX_SAFE_INTEGER;\n }\n case 'symbol': {\n return false;\n }\n case 'string': {\n return IS_UNSIGNED_INTEGER.test(value);\n }\n }\n}","const ESCAPE_REGEXP = /\\\\(\\\\)?/g;\nconst PROPERTY_REGEXP = RegExp(\n // Match anything that isn't a dot or bracket.\n \"[^.[\\\\]]+\" +\n \"|\" +\n // Or match property names within brackets.\n \"\\\\[(?:\" +\n // Match a non-string expression.\n \"([^\\\"'][^[]*)\" +\n \"|\" +\n // Or match strings (supports escaping characters).\n \"([\\\"'])((?:(?!\\\\2)[^\\\\\\\\]|\\\\\\\\.)*?)\\\\2\" +\n \")\\\\]\" +\n \"|\" +\n // Or match \"\" as the space between consecutive dots or empty brackets.\n \"(?=(?:\\\\.|\\\\[\\\\])(?:\\\\.|\\\\[\\\\]|$))\",\n \"g\",\n);\n\n/**\n * Converts a deep key string into an array of path segments.\n *\n * This function takes a string representing a deep key (e.g., 'a.b.c' or 'a[b][c]') and breaks it down into an array of strings, each representing a segment of the path.\n *\n * @param deepKey - The deep key string to convert.\n * @returns An array of strings, each representing a segment of the path.\n *\n * Examples:\n *\n * toPath('a.b.c') // Returns ['a', 'b', 'c']\n * toPath('a[b][c]') // Returns ['a', 'b', 'c']\n * toPath('.a.b.c') // Returns ['', 'a', 'b', 'c']\n * toPath('a[\"b.c\"].d') // Returns ['a', 'b.c', 'd']\n * toPath('') // Returns []\n * toPath('.a[b].c.d[e][\"f.g\"].h') // Returns ['', 'a', 'b', 'c', 'd', 'e', 'f.g', 'h']\n */\nexport function toPath(deepKey: string): string[] {\n const result: string[] = [];\n\n if (deepKey[0] === \".\") {\n result.push(\"\");\n }\n\n let match: RegExpExecArray | null;\n\n while ((match = PROPERTY_REGEXP.exec(deepKey)) !== null) {\n let [key, expr, quote, substr] = match;\n\n if (quote) {\n key = substr.replace(ESCAPE_REGEXP, \"$1\");\n } else if (expr) {\n key = expr.trim();\n }\n\n result.push(key);\n }\n\n return result;\n}\n","import { isIndex } from \"../_internal/isIndex.ts\";\nimport { toPath } from \"../_internal/toPath.ts\";\n\n/**\n * Sets the value at the specified path of the given object. If any part of the path does not exist, it will be created.\n *\n * @template T - The type of the object.\n * @param {Settable} obj - The object to modify.\n * @param {Path} path - The path of the property to set.\n * @param {any} value - The value to set.\n * @returns {T} - The modified object.\n *\n * @example\n * // Set a value in a nested object\n * const obj = { a: { b: { c: 3 } } };\n * set(obj, 'a.b.c', 4);\n * console.log(obj.a.b.c); // 4\n *\n * @example\n * // Set a value in an array\n * const arr = [1, 2, 3];\n * set(arr, 1, 4);\n * console.log(arr[1]); // 4\n *\n * @example\n * // Create non-existent path and set value\n * const obj = {};\n * set(obj, 'a.b.c', 4);\n * console.log(obj); // { a: { b: { c: 4 } } }\n */\nexport function set<T>(obj: object, path: PropertyKey | readonly PropertyKey[], value: unknown): T;\nexport function set<T extends object>(obj: T, path: PropertyKey | readonly PropertyKey[], value: unknown): T {\n const resolvedPath = Array.isArray(path)\n ? path\n : typeof path === 'string'\n ? toPath(path)\n : [path];\n\n let current: any = obj;\n\n for (let i = 0; i < resolvedPath.length - 1; i++) {\n const key = resolvedPath[i];\n const nextKey = resolvedPath[i + 1];\n\n if (current[key] == null) {\n current[key] = isIndex(nextKey) ? [] : {};\n }\n\n current = current[key];\n }\n\n const lastKey = resolvedPath[resolvedPath.length - 1];\n current[lastKey] = value;\n\n return obj;\n}\n","import { zip } from \"../../array/zip.ts\";\nimport { set } from \"../object/set.ts\";\n\n/**\n * Creates a deeply nested object given arrays of paths and values.\n *\n * This function takes two arrays: one containing arrays of property paths, and the other containing corresponding values.\n * It returns a new object where paths from the first array are used as key paths to set values, with corresponding elements from the second array as values.\n * Paths can be dot-separated strings or arrays of property names.\n * \n * If the `keys` array is longer than the `values` array, the remaining keys will have `undefined` as their values.\n *\n * @template V - The type of elements in the array.\n * @param {string[] | string[][]} keys - An array of property paths, each path can be a dot-separated string or an array of property names.\n * @param {V[]} values - An array of values corresponding to the property paths.\n * @returns {object} A new object composed of the given property paths and values.\n *\n * @example\n * const paths = ['a.b.c', 'd.e.f'];\n * const values = [1, 2];\n * const result = zipObjectDeep(paths, values);\n * // result will be { a: { b: { c: 1 } }, d: { e: { f: 2 } } }\n *\n * @example\n * const paths = [['a', 'b', 'c'], ['d', 'e', 'f']];\n * const values = [1, 2];\n * const result = zipObjectDeep(paths, values);\n * // result will be { a: { b: { c: 1 } }, d: { e: { f: 2 } } }\n * \n * @example\n * const paths = ['a.b[0].c', 'a.b[1].d'];\n * const values = [1, 2];\n * const result = zipObjectDeep(paths, values);\n * // result will be { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }\n */\nexport function zipObjectDeep<P extends string | number | symbol, V>(keys: P[], values: V[]): { [K in P]: V } {\n const result = {} as { [K in P]: V };\n const zipped = zip(keys, values);\n\n for (let i = 0; i < zipped.length; i++) {\n const [key, value] = zipped[i];\n\n if (key != null) {\n set(result, key, value);\n }\n }\n\n return result;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyBO,SAASA,OAAS,KAAmB,OAAe,GAAU;AACnE,SAAO,KAAK,IAAI,KAAK,MAAM,IAAI,GAAG,CAAC;AAEnC,MAAI,SAAS,GAAG;AACd,WAAO,CAAC;AAAA,EACV;AAEA,SAAO,MAAa,KAAK,IAAI;AAC/B;;;ACjCA,IAAM,sBAAsB;AAErB,SAAS,QAAQ,OAAoB;AAC1C,UAAQ,OAAO,OAAO;AAAA,IACpB,KAAK,UAAU;AACb,aAAO,OAAO,UAAU,KAAK,KAAK,SAAS,KAAK,QAAQ,OAAO;AAAA,IACjE;AAAA,IACA,KAAK,UAAU;AACb,aAAO;AAAA,IACT;AAAA,IACA,KAAK,UAAU;AACb,aAAO,oBAAoB,KAAK,KAAK;AAAA,IACvC;AAAA,EACF;AACF;;;ACdA,IAAM,gBAAgB;AACtB,IAAM,kBAAkB;AAAA;AAAA,EAEtB;AAAA,EAaA;AACF;AAmBO,SAAS,OAAO,SAA2B;AAChD,QAAM,SAAmB,CAAC;AAE1B,MAAI,QAAQ,CAAC,MAAM,KAAK;AACtB,WAAO,KAAK,EAAE;AAAA,EAChB;AAEA,MAAI;AAEJ,UAAQ,QAAQ,gBAAgB,KAAK,OAAO,OAAO,MAAM;AACvD,QAAI,CAAC,KAAK,MAAM,OAAO,MAAM,IAAI;AAEjC,QAAI,OAAO;AACT,YAAM,OAAO,QAAQ,eAAe,IAAI;AAAA,IAC1C,WAAW,MAAM;AACf,YAAM,KAAK,KAAK;AAAA,IAClB;AAEA,WAAO,KAAK,GAAG;AAAA,EACjB;AAEA,SAAO;AACT;;;AC3BO,SAAS,IAAsB,KAAQ,MAA4C,OAAmB;AAC3G,QAAM,eAAe,MAAM,QAAQ,IAAI,IACnC,OACA,OAAO,SAAS,WACd,OAAO,IAAI,IACX,CAAC,IAAI;AAEX,MAAI,UAAe;AAEnB,WAAS,IAAI,GAAG,IAAI,aAAa,SAAS,GAAG,KAAK;AAChD,UAAM,MAAM,aAAa,CAAC;AAC1B,UAAM,UAAU,aAAa,IAAI,CAAC;AAElC,QAAI,QAAQ,GAAG,KAAK,MAAM;AACxB,cAAQ,GAAG,IAAI,QAAQ,OAAO,IAAI,CAAC,IAAI,CAAC;AAAA,IAC1C;AAEA,cAAU,QAAQ,GAAG;AAAA,EACvB;AAEA,QAAM,UAAU,aAAa,aAAa,SAAS,CAAC;AACpD,UAAQ,OAAO,IAAI;AAEnB,SAAO;AACT;;;ACpBO,SAAS,cAAqD,MAAW,QAA8B;AAC5G,QAAM,SAAS,CAAC;AAChB,QAAM,SAAS,IAAI,MAAM,MAAM;AAE/B,WAAS,IAAI,GAAG,IAAI,OAAO,QAAQ,KAAK;AACtC,UAAM,CAAC,KAAK,KAAK,IAAI,OAAO,CAAC;AAE7B,QAAI,OAAO,MAAM;AACf,UAAI,QAAQ,KAAK,KAAK;AAAA,IACxB;AAAA,EACF;AAEA,SAAO;AACT;","names":["chunk"]}
|
package/dist/index.d.mts
CHANGED
|
@@ -83,4 +83,6 @@ export { snakeCase } from './string/snakeCase.mjs';
|
|
|
83
83
|
export { kebabCase } from './string/kebabCase.mjs';
|
|
84
84
|
export { lowerCase } from './string/lowerCase.mjs';
|
|
85
85
|
export { startCase } from './string/startCase.mjs';
|
|
86
|
+
export { startsWith } from './string/startsWith.mjs';
|
|
87
|
+
export { endsWith } from './string/endsWith.mjs';
|
|
86
88
|
export { capitalize } from './string/capitalize.mjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -83,4 +83,6 @@ export { snakeCase } from './string/snakeCase.js';
|
|
|
83
83
|
export { kebabCase } from './string/kebabCase.js';
|
|
84
84
|
export { lowerCase } from './string/lowerCase.js';
|
|
85
85
|
export { startCase } from './string/startCase.js';
|
|
86
|
+
export { startsWith } from './string/startsWith.js';
|
|
87
|
+
export { endsWith } from './string/endsWith.js';
|
|
86
88
|
export { capitalize } from './string/capitalize.js';
|
package/dist/index.js
CHANGED
|
@@ -51,6 +51,7 @@ __export(src_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,
|
|
@@ -96,6 +97,7 @@ __export(src_exports, {
|
|
|
96
97
|
shuffle: () => shuffle,
|
|
97
98
|
snakeCase: () => snakeCase,
|
|
98
99
|
startCase: () => startCase,
|
|
100
|
+
startsWith: () => startsWith,
|
|
99
101
|
sum: () => sum,
|
|
100
102
|
sumBy: () => sumBy,
|
|
101
103
|
tail: () => tail,
|
|
@@ -1040,6 +1042,16 @@ function startCase(str) {
|
|
|
1040
1042
|
}
|
|
1041
1043
|
return result;
|
|
1042
1044
|
}
|
|
1045
|
+
|
|
1046
|
+
// src/string/startsWith.ts
|
|
1047
|
+
var startsWith = (str, target, position = 0) => {
|
|
1048
|
+
return str.startsWith(target, position);
|
|
1049
|
+
};
|
|
1050
|
+
|
|
1051
|
+
// src/string/endsWith.ts
|
|
1052
|
+
var endsWith = (str, target, position = str.length) => {
|
|
1053
|
+
return str.endsWith(target, position);
|
|
1054
|
+
};
|
|
1043
1055
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1044
1056
|
0 && (module.exports = {
|
|
1045
1057
|
AbortError,
|
|
@@ -1059,6 +1071,7 @@ function startCase(str) {
|
|
|
1059
1071
|
dropRight,
|
|
1060
1072
|
dropRightWhile,
|
|
1061
1073
|
dropWhile,
|
|
1074
|
+
endsWith,
|
|
1062
1075
|
fill,
|
|
1063
1076
|
flatMap,
|
|
1064
1077
|
flatten,
|
|
@@ -1104,6 +1117,7 @@ function startCase(str) {
|
|
|
1104
1117
|
shuffle,
|
|
1105
1118
|
snakeCase,
|
|
1106
1119
|
startCase,
|
|
1120
|
+
startsWith,
|
|
1107
1121
|
sum,
|
|
1108
1122
|
sumBy,
|
|
1109
1123
|
tail,
|