es-toolkit 1.9.0-dev.186 → 1.9.0-dev.188

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.
Files changed (57) hide show
  1. package/dist/array/flattenDeep.js.map +1 -1
  2. package/dist/array/flattenDeep.mjs +1 -1
  3. package/dist/array/index.js.map +1 -1
  4. package/dist/array/index.mjs +32 -32
  5. package/dist/chunk-55NY5XRN.mjs +14 -0
  6. package/dist/chunk-55NY5XRN.mjs.map +1 -0
  7. package/dist/{chunk-HJPB4KC3.mjs → chunk-ML727RRJ.mjs} +1 -1
  8. package/dist/chunk-ML727RRJ.mjs.map +1 -0
  9. package/dist/chunk-R7WI75UB.mjs +14 -0
  10. package/dist/chunk-R7WI75UB.mjs.map +1 -0
  11. package/dist/chunk-SG4W5PWM.mjs +11 -0
  12. package/dist/chunk-SG4W5PWM.mjs.map +1 -0
  13. package/dist/chunk-TOORJ7XR.mjs +14 -0
  14. package/dist/chunk-TOORJ7XR.mjs.map +1 -0
  15. package/dist/function/index.mjs +6 -6
  16. package/dist/index.js +11 -7
  17. package/dist/index.js.map +1 -1
  18. package/dist/index.mjs +62 -63
  19. package/dist/math/index.mjs +9 -9
  20. package/dist/object/index.mjs +6 -6
  21. package/dist/predicate/index.mjs +6 -6
  22. package/dist/string/index.js +11 -7
  23. package/dist/string/index.js.map +1 -1
  24. package/dist/string/index.mjs +6 -7
  25. package/dist/string/kebabCase.js +7 -3
  26. package/dist/string/kebabCase.js.map +1 -1
  27. package/dist/string/kebabCase.mjs +2 -3
  28. package/dist/string/lowerCase.js +7 -3
  29. package/dist/string/lowerCase.js.map +1 -1
  30. package/dist/string/lowerCase.mjs +2 -3
  31. package/dist/string/snakeCase.js +7 -3
  32. package/dist/string/snakeCase.js.map +1 -1
  33. package/dist/string/snakeCase.mjs +2 -3
  34. package/package.json +1 -1
  35. package/dist/chunk-2M3YVRFS.mjs +0 -1
  36. package/dist/chunk-2M3YVRFS.mjs.map +0 -1
  37. package/dist/chunk-47QP3LTV.mjs +0 -14
  38. package/dist/chunk-47QP3LTV.mjs.map +0 -1
  39. package/dist/chunk-HJPB4KC3.mjs.map +0 -1
  40. package/dist/chunk-IJJCMZIV.mjs +0 -7
  41. package/dist/chunk-IJJCMZIV.mjs.map +0 -1
  42. package/dist/chunk-KPFMOZXV.mjs +0 -14
  43. package/dist/chunk-KPFMOZXV.mjs.map +0 -1
  44. package/dist/chunk-XWJ7NQF4.mjs +0 -14
  45. package/dist/chunk-XWJ7NQF4.mjs.map +0 -1
  46. package/dist/constants/caseSplitPattern.d.mts +0 -19
  47. package/dist/constants/caseSplitPattern.d.ts +0 -19
  48. package/dist/constants/caseSplitPattern.js +0 -31
  49. package/dist/constants/caseSplitPattern.js.map +0 -1
  50. package/dist/constants/caseSplitPattern.mjs +0 -8
  51. package/dist/constants/caseSplitPattern.mjs.map +0 -1
  52. package/dist/constants/index.d.mts +0 -1
  53. package/dist/constants/index.d.ts +0 -1
  54. package/dist/constants/index.js +0 -33
  55. package/dist/constants/index.js.map +0 -1
  56. package/dist/constants/index.mjs +0 -9
  57. package/dist/constants/index.mjs.map +0 -1
@@ -0,0 +1,14 @@
1
+ import {
2
+ getWords
3
+ } from "./chunk-SG4W5PWM.mjs";
4
+
5
+ // src/string/kebabCase.ts
6
+ var kebabCase = (str) => {
7
+ const words = getWords(str);
8
+ return words.map((word) => word.toLowerCase()).join("-");
9
+ };
10
+
11
+ export {
12
+ kebabCase
13
+ };
14
+ //# sourceMappingURL=chunk-TOORJ7XR.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/string/kebabCase.ts"],"sourcesContent":["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"],"mappings":";;;;;AAiBO,IAAM,YAAY,CAAC,QAAwB;AAChD,QAAM,QAAQ,SAAS,GAAG;AAC1B,SAAO,MAAM,IAAI,UAAQ,KAAK,YAAY,CAAC,EAAE,KAAK,GAAG;AACvD;","names":[]}
@@ -1,16 +1,16 @@
1
1
  import "../chunk-N6EM6ETS.mjs";
2
- import {
3
- once
4
- } from "../chunk-CMBC4MXG.mjs";
5
- import {
6
- throttle
7
- } from "../chunk-QOJGMVVR.mjs";
8
2
  import {
9
3
  debounce
10
4
  } from "../chunk-3IP4JVLL.mjs";
11
5
  import {
12
6
  noop
13
7
  } from "../chunk-LKXCOLNY.mjs";
8
+ import {
9
+ once
10
+ } from "../chunk-CMBC4MXG.mjs";
11
+ import {
12
+ throttle
13
+ } from "../chunk-QOJGMVVR.mjs";
14
14
  import "../chunk-2MM5EJJX.mjs";
15
15
  export {
16
16
  debounce,
package/dist/index.js CHANGED
@@ -854,25 +854,29 @@ function delay(ms, { signal } = {}) {
854
854
  });
855
855
  }
856
856
 
857
- // src/constants/caseSplitPattern.ts
857
+ // src/string/_internal/getWords.ts
858
858
  var CASE_SPLIT_PATTERN = /[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]+|[0-9]+/g;
859
+ function getWords(str) {
860
+ var _a;
861
+ return Array.from((_a = str.match(CASE_SPLIT_PATTERN)) != null ? _a : []);
862
+ }
859
863
 
860
864
  // src/string/snakeCase.ts
861
865
  var snakeCase = (str) => {
862
- const splitWords = str.match(CASE_SPLIT_PATTERN) || [];
863
- return splitWords.map((word) => word.toLowerCase()).join("_");
866
+ const words = getWords(str);
867
+ return words.map((word) => word.toLowerCase()).join("_");
864
868
  };
865
869
 
866
870
  // src/string/kebabCase.ts
867
871
  var kebabCase = (str) => {
868
- const splitWords = str.match(CASE_SPLIT_PATTERN) || [];
869
- return splitWords.map((word) => word.toLowerCase()).join("-");
872
+ const words = getWords(str);
873
+ return words.map((word) => word.toLowerCase()).join("-");
870
874
  };
871
875
 
872
876
  // src/string/lowerCase.ts
873
877
  var lowerCase = (str) => {
874
- const splitWords = str.match(CASE_SPLIT_PATTERN) || [];
875
- return splitWords.map((word) => word.toLowerCase()).join(" ");
878
+ const words = getWords(str);
879
+ return words.map((word) => word.toLowerCase()).join(" ");
876
880
  };
877
881
 
878
882
  // src/string/capitalize.ts