es-toolkit 1.49.0 → 1.50.0-dev.1977

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 (186) hide show
  1. package/CHANGELOG.md +46 -0
  2. package/dist/array/partition.d.mts +5 -4
  3. package/dist/array/partition.d.ts +5 -4
  4. package/dist/array/unzipWith.js +1 -1
  5. package/dist/array/unzipWith.mjs +1 -1
  6. package/dist/browser.global.js +3 -3
  7. package/dist/compat/_internal/ListIterateeCustom.d.mts +3 -2
  8. package/dist/compat/_internal/ListIterateeCustom.d.ts +3 -2
  9. package/dist/compat/_internal/assignValue.js +2 -3
  10. package/dist/compat/_internal/assignValue.mjs +2 -3
  11. package/dist/compat/_internal/createPadding.js +14 -0
  12. package/dist/compat/_internal/createPadding.mjs +13 -0
  13. package/dist/compat/_internal/isDeepKey.js +14 -1
  14. package/dist/compat/_internal/isDeepKey.mjs +14 -1
  15. package/dist/compat/_internal/isIterateeCall.js +2 -3
  16. package/dist/compat/_internal/isIterateeCall.mjs +2 -3
  17. package/dist/compat/_internal/regexMultiByte.js +11 -0
  18. package/dist/compat/_internal/regexMultiByte.mjs +11 -0
  19. package/dist/compat/array/every.js +5 -24
  20. package/dist/compat/array/every.mjs +5 -24
  21. package/dist/compat/array/filter.d.mts +7 -3
  22. package/dist/compat/array/filter.d.ts +7 -3
  23. package/dist/compat/array/filter.js +11 -11
  24. package/dist/compat/array/filter.mjs +11 -11
  25. package/dist/compat/array/find.d.mts +10 -6
  26. package/dist/compat/array/find.d.ts +10 -6
  27. package/dist/compat/array/find.js +1 -1
  28. package/dist/compat/array/find.mjs +1 -1
  29. package/dist/compat/array/findIndex.d.mts +0 -1
  30. package/dist/compat/array/findIndex.d.ts +0 -1
  31. package/dist/compat/array/findIndex.js +2 -1
  32. package/dist/compat/array/findIndex.mjs +2 -1
  33. package/dist/compat/array/findLast.d.mts +1 -1
  34. package/dist/compat/array/findLast.d.ts +1 -1
  35. package/dist/compat/array/findLast.js +12 -12
  36. package/dist/compat/array/findLast.mjs +12 -12
  37. package/dist/compat/array/findLastIndex.js +1 -0
  38. package/dist/compat/array/findLastIndex.mjs +1 -0
  39. package/dist/compat/array/flatMap.js +3 -2
  40. package/dist/compat/array/flatMap.mjs +3 -2
  41. package/dist/compat/array/flatMapDepth.js +2 -2
  42. package/dist/compat/array/flatMapDepth.mjs +2 -2
  43. package/dist/compat/array/flatten.d.mts +4 -5
  44. package/dist/compat/array/flatten.d.ts +4 -5
  45. package/dist/compat/array/flatten.js +14 -15
  46. package/dist/compat/array/flatten.mjs +14 -15
  47. package/dist/compat/array/flattenDeep.d.mts +1 -1
  48. package/dist/compat/array/flattenDeep.d.ts +1 -1
  49. package/dist/compat/array/flattenDeep.js +2 -2
  50. package/dist/compat/array/flattenDeep.mjs +2 -2
  51. package/dist/compat/array/flattenDepth.js +18 -2
  52. package/dist/compat/array/flattenDepth.mjs +18 -2
  53. package/dist/compat/array/groupBy.js +5 -4
  54. package/dist/compat/array/groupBy.mjs +4 -3
  55. package/dist/compat/array/includes.js +8 -3
  56. package/dist/compat/array/includes.mjs +8 -3
  57. package/dist/compat/array/indexOf.js +2 -1
  58. package/dist/compat/array/indexOf.mjs +2 -1
  59. package/dist/compat/array/intersectionBy.js +12 -5
  60. package/dist/compat/array/intersectionBy.mjs +12 -5
  61. package/dist/compat/array/intersectionWith.js +2 -3
  62. package/dist/compat/array/intersectionWith.mjs +2 -3
  63. package/dist/compat/array/invokeMap.js +3 -7
  64. package/dist/compat/array/invokeMap.mjs +3 -4
  65. package/dist/compat/array/lastIndexOf.js +3 -2
  66. package/dist/compat/array/lastIndexOf.mjs +3 -2
  67. package/dist/compat/array/nth.js +2 -2
  68. package/dist/compat/array/nth.mjs +2 -2
  69. package/dist/compat/array/pullAllWith.js +2 -3
  70. package/dist/compat/array/pullAllWith.mjs +2 -3
  71. package/dist/compat/array/size.js +2 -0
  72. package/dist/compat/array/size.mjs +2 -0
  73. package/dist/compat/array/sortedIndexOf.js +2 -3
  74. package/dist/compat/array/sortedIndexOf.mjs +2 -3
  75. package/dist/compat/array/sortedLastIndexOf.js +2 -3
  76. package/dist/compat/array/sortedLastIndexOf.mjs +2 -3
  77. package/dist/compat/compat.d.mts +4 -3
  78. package/dist/compat/compat.d.ts +4 -3
  79. package/dist/compat/compat.js +10 -11
  80. package/dist/compat/compat.mjs +10 -11
  81. package/dist/compat/index.d.mts +4 -3
  82. package/dist/compat/index.d.ts +4 -3
  83. package/dist/compat/index.js +10 -9
  84. package/dist/compat/index.mjs +10 -9
  85. package/dist/compat/math/inRange.d.mts +5 -2
  86. package/dist/compat/math/inRange.d.ts +5 -2
  87. package/dist/compat/math/inRange.js +14 -11
  88. package/dist/compat/math/inRange.mjs +14 -11
  89. package/dist/compat/math/maxBy.d.mts +1 -1
  90. package/dist/compat/math/maxBy.d.ts +1 -1
  91. package/dist/compat/math/maxBy.js +18 -4
  92. package/dist/compat/math/maxBy.mjs +18 -4
  93. package/dist/compat/math/minBy.d.mts +1 -1
  94. package/dist/compat/math/minBy.d.ts +1 -1
  95. package/dist/compat/math/minBy.js +18 -4
  96. package/dist/compat/math/minBy.mjs +18 -4
  97. package/dist/compat/object/assign.js +2 -3
  98. package/dist/compat/object/assign.mjs +2 -3
  99. package/dist/compat/object/assignIn.js +2 -3
  100. package/dist/compat/object/assignIn.mjs +2 -3
  101. package/dist/compat/object/assignInWith.js +2 -3
  102. package/dist/compat/object/assignInWith.mjs +2 -3
  103. package/dist/compat/object/assignWith.js +2 -3
  104. package/dist/compat/object/assignWith.mjs +2 -3
  105. package/dist/compat/object/create.js +1 -1
  106. package/dist/compat/object/create.mjs +1 -1
  107. package/dist/compat/object/defaults.js +2 -3
  108. package/dist/compat/object/defaults.mjs +2 -3
  109. package/dist/compat/object/has.js +1 -1
  110. package/dist/compat/object/has.mjs +1 -1
  111. package/dist/compat/object/hasIn.js +1 -1
  112. package/dist/compat/object/hasIn.mjs +1 -1
  113. package/dist/compat/object/unset.js +1 -1
  114. package/dist/compat/object/unset.mjs +1 -1
  115. package/dist/compat/object/values.js +5 -1
  116. package/dist/compat/object/values.mjs +5 -1
  117. package/dist/compat/predicate/isMatchWith.js +4 -5
  118. package/dist/compat/predicate/isMatchWith.mjs +4 -5
  119. package/dist/compat/string/camelCase.js +6 -2
  120. package/dist/compat/string/camelCase.mjs +6 -2
  121. package/dist/compat/string/kebabCase.js +2 -2
  122. package/dist/compat/string/kebabCase.mjs +2 -2
  123. package/dist/compat/string/lowerCase.js +2 -2
  124. package/dist/compat/string/lowerCase.mjs +2 -2
  125. package/dist/compat/string/pad.js +10 -3
  126. package/dist/compat/string/pad.mjs +10 -3
  127. package/dist/compat/string/padEnd.js +7 -1
  128. package/dist/compat/string/padEnd.mjs +7 -1
  129. package/dist/compat/string/padStart.js +7 -1
  130. package/dist/compat/string/padStart.mjs +7 -1
  131. package/dist/compat/string/snakeCase.js +2 -2
  132. package/dist/compat/string/snakeCase.mjs +2 -2
  133. package/dist/compat/string/startCase.js +1 -1
  134. package/dist/compat/string/startCase.mjs +1 -1
  135. package/dist/compat/string/template.d.mts +1 -1
  136. package/dist/compat/string/template.d.ts +1 -1
  137. package/dist/compat/string/templateSettings.d.mts +18 -1
  138. package/dist/compat/string/templateSettings.d.ts +18 -1
  139. package/dist/compat/string/templateSettings.js +4 -1
  140. package/dist/compat/string/templateSettings.mjs +5 -1
  141. package/dist/compat/string/truncate.js +2 -9
  142. package/dist/compat/string/truncate.mjs +1 -8
  143. package/dist/compat/string/upperCase.js +2 -2
  144. package/dist/compat/string/upperCase.mjs +2 -2
  145. package/dist/compat/util/eq.d.mts +17 -1
  146. package/dist/compat/util/eq.d.ts +17 -1
  147. package/dist/compat/util/eq.js +19 -1
  148. package/dist/compat/util/eq.mjs +19 -1
  149. package/dist/compat/util/toArray.js +2 -1
  150. package/dist/compat/util/toArray.mjs +2 -1
  151. package/dist/fp/flow.d.mts +213 -0
  152. package/dist/fp/flow.d.ts +213 -0
  153. package/dist/fp/flow.js +50 -0
  154. package/dist/fp/flow.mjs +50 -0
  155. package/dist/fp/index.d.mts +2 -1
  156. package/dist/fp/index.d.ts +2 -1
  157. package/dist/fp/index.js +3 -1
  158. package/dist/fp/index.mjs +3 -2
  159. package/dist/fp/pipe.js +8 -12
  160. package/dist/fp/pipe.mjs +8 -12
  161. package/dist/map/hasValue.js +2 -2
  162. package/dist/map/hasValue.mjs +2 -2
  163. package/dist/predicate/isEqualWith.js +2 -3
  164. package/dist/predicate/isEqualWith.mjs +2 -3
  165. package/dist/string/deburr.js +1 -1
  166. package/dist/string/deburr.mjs +1 -1
  167. package/dist/types/DeepPartial.d.mts +21 -0
  168. package/dist/types/DeepPartial.d.ts +21 -0
  169. package/dist/types/DeepReadonly.d.mts +22 -0
  170. package/dist/types/DeepReadonly.d.ts +22 -0
  171. package/dist/types/NonEmptyArray.d.mts +14 -0
  172. package/dist/types/NonEmptyArray.d.ts +14 -0
  173. package/dist/types/Simplify.d.mts +18 -0
  174. package/dist/types/Simplify.d.ts +18 -0
  175. package/dist/types/ValueOf.d.mts +14 -0
  176. package/dist/types/ValueOf.d.ts +14 -0
  177. package/dist/types/Writable.d.mts +15 -0
  178. package/dist/types/Writable.d.ts +15 -0
  179. package/dist/types/index.d.mts +7 -0
  180. package/dist/types/index.d.ts +7 -0
  181. package/package.json +23 -7
  182. package/types.d.ts +1 -0
  183. package/dist/_internal/isEqualsSameValueZero.d.mts +0 -17
  184. package/dist/_internal/isEqualsSameValueZero.d.ts +0 -17
  185. package/dist/_internal/isEqualsSameValueZero.js +0 -19
  186. package/dist/_internal/isEqualsSameValueZero.mjs +0 -19
@@ -1,5 +1,4 @@
1
- const require_isEqualsSameValueZero = require("../../_internal/isEqualsSameValueZero.js");
2
- require("../util/eq.js");
1
+ const require_eq = require("../util/eq.js");
3
2
  const require_keys = require("./keys.js");
4
3
  //#region src/compat/object/assignWith.ts
5
4
  /**
@@ -41,7 +40,7 @@ function assignWithImpl(object, source, getValueToAssign) {
41
40
  const objValue = object[key];
42
41
  const srcValue = source[key];
43
42
  const newValue = getValueToAssign?.(objValue, srcValue, key, object, source) ?? srcValue;
44
- if (!(key in object) || !require_isEqualsSameValueZero.isEqualsSameValueZero(objValue, newValue)) object[key] = newValue;
43
+ if (!(key in object) || !require_eq.eq(objValue, newValue)) object[key] = newValue;
45
44
  }
46
45
  }
47
46
  //#endregion
@@ -1,5 +1,4 @@
1
- import { isEqualsSameValueZero } from "../../_internal/isEqualsSameValueZero.mjs";
2
- import "../util/eq.mjs";
1
+ import { eq } from "../util/eq.mjs";
3
2
  import { keys } from "./keys.mjs";
4
3
  //#region src/compat/object/assignWith.ts
5
4
  /**
@@ -41,7 +40,7 @@ function assignWithImpl(object, source, getValueToAssign) {
41
40
  const objValue = object[key];
42
41
  const srcValue = source[key];
43
42
  const newValue = getValueToAssign?.(objValue, srcValue, key, object, source) ?? srcValue;
44
- if (!(key in object) || !isEqualsSameValueZero(objValue, newValue)) object[key] = newValue;
43
+ if (!(key in object) || !eq(objValue, newValue)) object[key] = newValue;
45
44
  }
46
45
  }
47
46
  //#endregion
@@ -1,6 +1,6 @@
1
1
  const require_isObject = require("../predicate/isObject.js");
2
- const require_assignValue = require("../_internal/assignValue.js");
3
2
  const require_keys = require("./keys.js");
3
+ const require_assignValue = require("../_internal/assignValue.js");
4
4
  //#region src/compat/object/create.ts
5
5
  /**
6
6
  * Creates an object that inherits from the prototype object.
@@ -1,6 +1,6 @@
1
1
  import { isObject } from "../predicate/isObject.mjs";
2
- import { assignValue } from "../_internal/assignValue.mjs";
3
2
  import { keys } from "./keys.mjs";
3
+ import { assignValue } from "../_internal/assignValue.mjs";
4
4
  //#region src/compat/object/create.ts
5
5
  /**
6
6
  * Creates an object that inherits from the prototype object.
@@ -1,5 +1,4 @@
1
- const require_isEqualsSameValueZero = require("../../_internal/isEqualsSameValueZero.js");
2
- require("../util/eq.js");
1
+ const require_eq = require("../util/eq.js");
3
2
  const require_isNil = require("../../predicate/isNil.js");
4
3
  const require_isIterateeCall = require("../_internal/isIterateeCall.js");
5
4
  //#region src/compat/object/defaults.ts
@@ -38,7 +37,7 @@ function defaults(object, ...sources) {
38
37
  for (let j = 0; j < keys.length; j++) {
39
38
  const key = keys[j];
40
39
  const value = object[key];
41
- if (value === void 0 || !Object.hasOwn(object, key) && require_isEqualsSameValueZero.isEqualsSameValueZero(value, objectProto[key])) object[key] = source[key];
40
+ if (value === void 0 || !Object.hasOwn(object, key) && require_eq.eq(value, objectProto[key])) object[key] = source[key];
42
41
  }
43
42
  }
44
43
  return object;
@@ -1,5 +1,4 @@
1
- import { isEqualsSameValueZero } from "../../_internal/isEqualsSameValueZero.mjs";
2
- import "../util/eq.mjs";
1
+ import { eq } from "../util/eq.mjs";
3
2
  import { isNil } from "../../predicate/isNil.mjs";
4
3
  import { isIterateeCall } from "../_internal/isIterateeCall.mjs";
5
4
  //#region src/compat/object/defaults.ts
@@ -38,7 +37,7 @@ function defaults(object, ...sources) {
38
37
  for (let j = 0; j < keys.length; j++) {
39
38
  const key = keys[j];
40
39
  const value = object[key];
41
- if (value === void 0 || !Object.hasOwn(object, key) && isEqualsSameValueZero(value, objectProto[key])) object[key] = source[key];
40
+ if (value === void 0 || !Object.hasOwn(object, key) && eq(value, objectProto[key])) object[key] = source[key];
42
41
  }
43
42
  }
44
43
  return object;
@@ -35,7 +35,7 @@ const require_isArguments = require("../predicate/isArguments.js");
35
35
  function has(object, path) {
36
36
  let resolvedPath;
37
37
  if (Array.isArray(path)) resolvedPath = path;
38
- else if (typeof path === "string" && require_isDeepKey.isDeepKey(path) && object?.[path] == null) resolvedPath = require_toPath.toPath(path);
38
+ else if (typeof path === "string" && require_isDeepKey.isDeepKey(path) && !(path in Object(object))) resolvedPath = require_toPath.toPath(path);
39
39
  else resolvedPath = [path];
40
40
  if (resolvedPath.length === 0) return false;
41
41
  let current = object;
@@ -35,7 +35,7 @@ import { isArguments } from "../predicate/isArguments.mjs";
35
35
  function has(object, path) {
36
36
  let resolvedPath;
37
37
  if (Array.isArray(path)) resolvedPath = path;
38
- else if (typeof path === "string" && isDeepKey(path) && object?.[path] == null) resolvedPath = toPath(path);
38
+ else if (typeof path === "string" && isDeepKey(path) && !(path in Object(object))) resolvedPath = toPath(path);
39
39
  else resolvedPath = [path];
40
40
  if (resolvedPath.length === 0) return false;
41
41
  let current = object;
@@ -45,7 +45,7 @@ function hasIn(object, path) {
45
45
  if (object == null) return false;
46
46
  let resolvedPath;
47
47
  if (Array.isArray(path)) resolvedPath = path;
48
- else if (typeof path === "string" && require_isDeepKey.isDeepKey(path) && object[path] == null) resolvedPath = require_toPath.toPath(path);
48
+ else if (typeof path === "string" && require_isDeepKey.isDeepKey(path) && !(path in Object(object))) resolvedPath = require_toPath.toPath(path);
49
49
  else resolvedPath = [path];
50
50
  if (resolvedPath.length === 0) return false;
51
51
  let current = object;
@@ -45,7 +45,7 @@ function hasIn(object, path) {
45
45
  if (object == null) return false;
46
46
  let resolvedPath;
47
47
  if (Array.isArray(path)) resolvedPath = path;
48
- else if (typeof path === "string" && isDeepKey(path) && object[path] == null) resolvedPath = toPath(path);
48
+ else if (typeof path === "string" && isDeepKey(path) && !(path in Object(object))) resolvedPath = toPath(path);
49
49
  else resolvedPath = [path];
50
50
  if (resolvedPath.length === 0) return false;
51
51
  let current = object;
@@ -40,7 +40,7 @@ function unset(obj, path) {
40
40
  return false;
41
41
  }
42
42
  case "string":
43
- if (obj?.[path] === void 0 && require_isDeepKey.isDeepKey(path)) return unsetWithPath(obj, require_toPath.toPath(path));
43
+ if (obj?.[path] === void 0 && require_isDeepKey.isDeepKey(path) && !Object.hasOwn(obj, path)) return unsetWithPath(obj, require_toPath.toPath(path));
44
44
  if (require_isUnsafeProperty.isUnsafeProperty(path)) return false;
45
45
  try {
46
46
  delete obj[path];
@@ -40,7 +40,7 @@ function unset(obj, path) {
40
40
  return false;
41
41
  }
42
42
  case "string":
43
- if (obj?.[path] === void 0 && isDeepKey(path)) return unsetWithPath(obj, toPath(path));
43
+ if (obj?.[path] === void 0 && isDeepKey(path) && !Object.hasOwn(obj, path)) return unsetWithPath(obj, toPath(path));
44
44
  if (isUnsafeProperty(path)) return false;
45
45
  try {
46
46
  delete obj[path];
@@ -1,3 +1,4 @@
1
+ const require_keys = require("./keys.js");
1
2
  //#region src/compat/object/values.ts
2
3
  /**
3
4
  * Creates an array of the own enumerable property values of `object`.
@@ -10,7 +11,10 @@
10
11
  */
11
12
  function values(object) {
12
13
  if (object == null) return [];
13
- return Object.values(object);
14
+ const objectKeys = require_keys.keys(object);
15
+ const result = new Array(objectKeys.length);
16
+ for (let i = 0; i < objectKeys.length; i++) result[i] = object[objectKeys[i]];
17
+ return result;
14
18
  }
15
19
  //#endregion
16
20
  exports.values = values;
@@ -1,3 +1,4 @@
1
+ import { keys } from "./keys.mjs";
1
2
  //#region src/compat/object/values.ts
2
3
  /**
3
4
  * Creates an array of the own enumerable property values of `object`.
@@ -10,7 +11,10 @@
10
11
  */
11
12
  function values(object) {
12
13
  if (object == null) return [];
13
- return Object.values(object);
14
+ const objectKeys = keys(object);
15
+ const result = new Array(objectKeys.length);
16
+ for (let i = 0; i < objectKeys.length; i++) result[i] = object[objectKeys[i]];
17
+ return result;
14
18
  }
15
19
  //#endregion
16
20
  export { values };
@@ -1,6 +1,5 @@
1
1
  const require_isPrimitive = require("../../predicate/isPrimitive.js");
2
- const require_isEqualsSameValueZero = require("../../_internal/isEqualsSameValueZero.js");
3
- require("../util/eq.js");
2
+ const require_eq = require("../util/eq.js");
4
3
  const require_isObject = require("./isObject.js");
5
4
  //#region src/compat/predicate/isMatchWith.ts
6
5
  /**
@@ -86,14 +85,14 @@ function isMatchWithInternal(target, source, compare, stack, isRoot = false) {
86
85
  case "object": return isObjectMatch(target, source, compare, stack);
87
86
  case "function":
88
87
  if (Object.keys(source).length > 0) return isMatchWithInternal(target, { ...source }, compare, stack, isRoot);
89
- return require_isEqualsSameValueZero.isEqualsSameValueZero(target, source);
88
+ return require_eq.eq(target, source);
90
89
  default:
91
- if (!require_isObject.isObject(target)) return require_isEqualsSameValueZero.isEqualsSameValueZero(target, source);
90
+ if (!require_isObject.isObject(target)) return require_eq.eq(target, source);
92
91
  if (isRoot) {
93
92
  if (typeof source === "string") return source === "";
94
93
  return true;
95
94
  }
96
- return require_isEqualsSameValueZero.isEqualsSameValueZero(target, source);
95
+ return require_eq.eq(target, source);
97
96
  }
98
97
  }
99
98
  function isObjectMatch(target, source, compare, stack) {
@@ -1,6 +1,5 @@
1
1
  import { isPrimitive } from "../../predicate/isPrimitive.mjs";
2
- import { isEqualsSameValueZero } from "../../_internal/isEqualsSameValueZero.mjs";
3
- import "../util/eq.mjs";
2
+ import { eq } from "../util/eq.mjs";
4
3
  import { isObject } from "./isObject.mjs";
5
4
  //#region src/compat/predicate/isMatchWith.ts
6
5
  /**
@@ -86,14 +85,14 @@ function isMatchWithInternal(target, source, compare, stack, isRoot = false) {
86
85
  case "object": return isObjectMatch(target, source, compare, stack);
87
86
  case "function":
88
87
  if (Object.keys(source).length > 0) return isMatchWithInternal(target, { ...source }, compare, stack, isRoot);
89
- return isEqualsSameValueZero(target, source);
88
+ return eq(target, source);
90
89
  default:
91
- if (!isObject(target)) return isEqualsSameValueZero(target, source);
90
+ if (!isObject(target)) return eq(target, source);
92
91
  if (isRoot) {
93
92
  if (typeof source === "string") return source === "";
94
93
  return true;
95
94
  }
96
- return isEqualsSameValueZero(target, source);
95
+ return eq(target, source);
97
96
  }
98
97
  }
99
98
  function isObjectMatch(target, source, compare, stack) {
@@ -1,5 +1,6 @@
1
- const require_camelCase = require("../../string/camelCase.js");
1
+ const require_capitalize = require("../../string/capitalize.js");
2
2
  const require_deburr = require("./deburr.js");
3
+ const require_words = require("./words.js");
3
4
  const require_normalizeForCase = require("../_internal/normalizeForCase.js");
4
5
  //#region src/compat/string/camelCase.ts
5
6
  /**
@@ -18,7 +19,10 @@ const require_normalizeForCase = require("../_internal/normalizeForCase.js");
18
19
  * const convertedStr4 = camelCase('HTTPRequest') // returns 'httpRequest'
19
20
  */
20
21
  function camelCase(str) {
21
- return require_camelCase.camelCase(require_normalizeForCase.normalizeForCase(require_deburr.deburr(str)));
22
+ const splitWords = require_words.words(require_normalizeForCase.normalizeForCase(require_deburr.deburr(str)));
23
+ if (splitWords.length === 0) return "";
24
+ const [first, ...rest] = splitWords;
25
+ return `${first.toLowerCase()}${rest.map((word) => require_capitalize.capitalize(word)).join("")}`;
22
26
  }
23
27
  //#endregion
24
28
  exports.camelCase = camelCase;
@@ -1,5 +1,6 @@
1
- import { camelCase as camelCase$1 } from "../../string/camelCase.mjs";
1
+ import { capitalize } from "../../string/capitalize.mjs";
2
2
  import { deburr } from "./deburr.mjs";
3
+ import { words } from "./words.mjs";
3
4
  import { normalizeForCase } from "../_internal/normalizeForCase.mjs";
4
5
  //#region src/compat/string/camelCase.ts
5
6
  /**
@@ -18,7 +19,10 @@ import { normalizeForCase } from "../_internal/normalizeForCase.mjs";
18
19
  * const convertedStr4 = camelCase('HTTPRequest') // returns 'httpRequest'
19
20
  */
20
21
  function camelCase(str) {
21
- return camelCase$1(normalizeForCase(deburr(str)));
22
+ const splitWords = words(normalizeForCase(deburr(str)));
23
+ if (splitWords.length === 0) return "";
24
+ const [first, ...rest] = splitWords;
25
+ return `${first.toLowerCase()}${rest.map((word) => capitalize(word)).join("")}`;
22
26
  }
23
27
  //#endregion
24
28
  export { camelCase };
@@ -1,5 +1,5 @@
1
- const require_kebabCase = require("../../string/kebabCase.js");
2
1
  const require_deburr = require("./deburr.js");
2
+ const require_words = require("./words.js");
3
3
  const require_normalizeForCase = require("../_internal/normalizeForCase.js");
4
4
  //#region src/compat/string/kebabCase.ts
5
5
  /**
@@ -17,7 +17,7 @@ const require_normalizeForCase = require("../_internal/normalizeForCase.js");
17
17
  * const convertedStr4 = kebabCase('HTTPRequest') // returns 'http-request'
18
18
  */
19
19
  function kebabCase(str) {
20
- return require_kebabCase.kebabCase(require_normalizeForCase.normalizeForCase(require_deburr.deburr(str)));
20
+ return require_words.words(require_normalizeForCase.normalizeForCase(require_deburr.deburr(str))).map((word) => word.toLowerCase()).join("-");
21
21
  }
22
22
  //#endregion
23
23
  exports.kebabCase = kebabCase;
@@ -1,5 +1,5 @@
1
- import { kebabCase as kebabCase$1 } from "../../string/kebabCase.mjs";
2
1
  import { deburr } from "./deburr.mjs";
2
+ import { words } from "./words.mjs";
3
3
  import { normalizeForCase } from "../_internal/normalizeForCase.mjs";
4
4
  //#region src/compat/string/kebabCase.ts
5
5
  /**
@@ -17,7 +17,7 @@ import { normalizeForCase } from "../_internal/normalizeForCase.mjs";
17
17
  * const convertedStr4 = kebabCase('HTTPRequest') // returns 'http-request'
18
18
  */
19
19
  function kebabCase(str) {
20
- return kebabCase$1(normalizeForCase(deburr(str)));
20
+ return words(normalizeForCase(deburr(str))).map((word) => word.toLowerCase()).join("-");
21
21
  }
22
22
  //#endregion
23
23
  export { kebabCase };
@@ -1,5 +1,5 @@
1
- const require_lowerCase = require("../../string/lowerCase.js");
2
1
  const require_deburr = require("./deburr.js");
2
+ const require_words = require("./words.js");
3
3
  const require_normalizeForCase = require("../_internal/normalizeForCase.js");
4
4
  //#region src/compat/string/lowerCase.ts
5
5
  /**
@@ -17,7 +17,7 @@ const require_normalizeForCase = require("../_internal/normalizeForCase.js");
17
17
  * const convertedStr4 = lowerCase('HTTPRequest') // returns 'http request'
18
18
  */
19
19
  function lowerCase(str) {
20
- return require_lowerCase.lowerCase(require_normalizeForCase.normalizeForCase(require_deburr.deburr(str)));
20
+ return require_words.words(require_normalizeForCase.normalizeForCase(require_deburr.deburr(str))).map((word) => word.toLowerCase()).join(" ");
21
21
  }
22
22
  //#endregion
23
23
  exports.lowerCase = lowerCase;
@@ -1,5 +1,5 @@
1
- import { lowerCase as lowerCase$1 } from "../../string/lowerCase.mjs";
2
1
  import { deburr } from "./deburr.mjs";
2
+ import { words } from "./words.mjs";
3
3
  import { normalizeForCase } from "../_internal/normalizeForCase.mjs";
4
4
  //#region src/compat/string/lowerCase.ts
5
5
  /**
@@ -17,7 +17,7 @@ import { normalizeForCase } from "../_internal/normalizeForCase.mjs";
17
17
  * const convertedStr4 = lowerCase('HTTPRequest') // returns 'http request'
18
18
  */
19
19
  function lowerCase(str) {
20
- return lowerCase$1(normalizeForCase(deburr(str)));
20
+ return words(normalizeForCase(deburr(str))).map((word) => word.toLowerCase()).join(" ");
21
21
  }
22
22
  //#endregion
23
23
  export { lowerCase };
@@ -1,5 +1,6 @@
1
- const require_pad = require("../../string/pad.js");
2
1
  const require_toString = require("../util/toString.js");
2
+ const require_toInteger = require("../util/toInteger.js");
3
+ const require_createPadding = require("../_internal/createPadding.js");
3
4
  //#region src/compat/string/pad.ts
4
5
  /**
5
6
  * Pads string on the left and right sides if it's shorter than length. Padding characters are truncated if they can't be evenly divided by length.
@@ -17,8 +18,14 @@ const require_toString = require("../util/toString.js");
17
18
  * const result4 = pad('abc', 2); // result will be 'abc'
18
19
  *
19
20
  */
20
- function pad(str, length, chars) {
21
- return require_pad.pad(require_toString.toString(str), length, chars);
21
+ function pad(str, length = 0, chars = " ") {
22
+ const value = require_toString.toString(str);
23
+ const targetLength = require_toInteger.toInteger(length);
24
+ const strLength = require_createPadding.stringSize(value);
25
+ if (targetLength <= strLength) return value;
26
+ const mid = (targetLength - strLength) / 2;
27
+ const padChars = `${chars}`;
28
+ return require_createPadding.createPadding(Math.floor(mid), padChars) + value + require_createPadding.createPadding(Math.ceil(mid), padChars);
22
29
  }
23
30
  //#endregion
24
31
  exports.pad = pad;
@@ -1,5 +1,6 @@
1
- import { pad as pad$1 } from "../../string/pad.mjs";
2
1
  import { toString } from "../util/toString.mjs";
2
+ import { toInteger } from "../util/toInteger.mjs";
3
+ import { createPadding, stringSize } from "../_internal/createPadding.mjs";
3
4
  //#region src/compat/string/pad.ts
4
5
  /**
5
6
  * Pads string on the left and right sides if it's shorter than length. Padding characters are truncated if they can't be evenly divided by length.
@@ -17,8 +18,14 @@ import { toString } from "../util/toString.mjs";
17
18
  * const result4 = pad('abc', 2); // result will be 'abc'
18
19
  *
19
20
  */
20
- function pad(str, length, chars) {
21
- return pad$1(toString(str), length, chars);
21
+ function pad(str, length = 0, chars = " ") {
22
+ const value = toString(str);
23
+ const targetLength = toInteger(length);
24
+ const strLength = stringSize(value);
25
+ if (targetLength <= strLength) return value;
26
+ const mid = (targetLength - strLength) / 2;
27
+ const padChars = `${chars}`;
28
+ return createPadding(Math.floor(mid), padChars) + value + createPadding(Math.ceil(mid), padChars);
22
29
  }
23
30
  //#endregion
24
31
  export { pad };
@@ -1,4 +1,6 @@
1
1
  const require_toString = require("../util/toString.js");
2
+ const require_toInteger = require("../util/toInteger.js");
3
+ const require_createPadding = require("../_internal/createPadding.js");
2
4
  //#region src/compat/string/padEnd.ts
3
5
  /**
4
6
  * Pads the end of a string with a given character until it reaches the specified length.
@@ -18,7 +20,11 @@ const require_toString = require("../util/toString.js");
18
20
  * const result4 = padEnd('abc', 2); // result will be 'abc'
19
21
  */
20
22
  function padEnd(str, length = 0, chars = " ") {
21
- return require_toString.toString(str).padEnd(length, chars);
23
+ const value = require_toString.toString(str);
24
+ const targetLength = require_toInteger.toInteger(length);
25
+ const strLength = require_createPadding.stringSize(value);
26
+ if (targetLength <= strLength) return value;
27
+ return value + require_createPadding.createPadding(targetLength - strLength, `${chars}`);
22
28
  }
23
29
  //#endregion
24
30
  exports.padEnd = padEnd;
@@ -1,4 +1,6 @@
1
1
  import { toString } from "../util/toString.mjs";
2
+ import { toInteger } from "../util/toInteger.mjs";
3
+ import { createPadding, stringSize } from "../_internal/createPadding.mjs";
2
4
  //#region src/compat/string/padEnd.ts
3
5
  /**
4
6
  * Pads the end of a string with a given character until it reaches the specified length.
@@ -18,7 +20,11 @@ import { toString } from "../util/toString.mjs";
18
20
  * const result4 = padEnd('abc', 2); // result will be 'abc'
19
21
  */
20
22
  function padEnd(str, length = 0, chars = " ") {
21
- return toString(str).padEnd(length, chars);
23
+ const value = toString(str);
24
+ const targetLength = toInteger(length);
25
+ const strLength = stringSize(value);
26
+ if (targetLength <= strLength) return value;
27
+ return value + createPadding(targetLength - strLength, `${chars}`);
22
28
  }
23
29
  //#endregion
24
30
  export { padEnd };
@@ -1,4 +1,6 @@
1
1
  const require_toString = require("../util/toString.js");
2
+ const require_toInteger = require("../util/toInteger.js");
3
+ const require_createPadding = require("../_internal/createPadding.js");
2
4
  //#region src/compat/string/padStart.ts
3
5
  /**
4
6
  * Pads the start of a string with a given character until it reaches the specified length.
@@ -18,7 +20,11 @@ const require_toString = require("../util/toString.js");
18
20
  * const result4 = padStart('abc', 2); // result will be 'abc'
19
21
  */
20
22
  function padStart(str, length = 0, chars = " ") {
21
- return require_toString.toString(str).padStart(length, chars);
23
+ const value = require_toString.toString(str);
24
+ const targetLength = require_toInteger.toInteger(length);
25
+ const strLength = require_createPadding.stringSize(value);
26
+ if (targetLength <= strLength) return value;
27
+ return require_createPadding.createPadding(targetLength - strLength, `${chars}`) + value;
22
28
  }
23
29
  //#endregion
24
30
  exports.padStart = padStart;
@@ -1,4 +1,6 @@
1
1
  import { toString } from "../util/toString.mjs";
2
+ import { toInteger } from "../util/toInteger.mjs";
3
+ import { createPadding, stringSize } from "../_internal/createPadding.mjs";
2
4
  //#region src/compat/string/padStart.ts
3
5
  /**
4
6
  * Pads the start of a string with a given character until it reaches the specified length.
@@ -18,7 +20,11 @@ import { toString } from "../util/toString.mjs";
18
20
  * const result4 = padStart('abc', 2); // result will be 'abc'
19
21
  */
20
22
  function padStart(str, length = 0, chars = " ") {
21
- return toString(str).padStart(length, chars);
23
+ const value = toString(str);
24
+ const targetLength = toInteger(length);
25
+ const strLength = stringSize(value);
26
+ if (targetLength <= strLength) return value;
27
+ return createPadding(targetLength - strLength, `${chars}`) + value;
22
28
  }
23
29
  //#endregion
24
30
  export { padStart };
@@ -1,5 +1,5 @@
1
- const require_snakeCase = require("../../string/snakeCase.js");
2
1
  const require_deburr = require("./deburr.js");
2
+ const require_words = require("./words.js");
3
3
  const require_normalizeForCase = require("../_internal/normalizeForCase.js");
4
4
  //#region src/compat/string/snakeCase.ts
5
5
  /**
@@ -17,7 +17,7 @@ const require_normalizeForCase = require("../_internal/normalizeForCase.js");
17
17
  * const convertedStr4 = snakeCase('HTTPRequest') // returns 'http_request'
18
18
  */
19
19
  function snakeCase(str) {
20
- return require_snakeCase.snakeCase(require_normalizeForCase.normalizeForCase(require_deburr.deburr(str)));
20
+ return require_words.words(require_normalizeForCase.normalizeForCase(require_deburr.deburr(str))).map((word) => word.toLowerCase()).join("_");
21
21
  }
22
22
  //#endregion
23
23
  exports.snakeCase = snakeCase;
@@ -1,5 +1,5 @@
1
- import { snakeCase as snakeCase$1 } from "../../string/snakeCase.mjs";
2
1
  import { deburr } from "./deburr.mjs";
2
+ import { words } from "./words.mjs";
3
3
  import { normalizeForCase } from "../_internal/normalizeForCase.mjs";
4
4
  //#region src/compat/string/snakeCase.ts
5
5
  /**
@@ -17,7 +17,7 @@ import { normalizeForCase } from "../_internal/normalizeForCase.mjs";
17
17
  * const convertedStr4 = snakeCase('HTTPRequest') // returns 'http_request'
18
18
  */
19
19
  function snakeCase(str) {
20
- return snakeCase$1(normalizeForCase(deburr(str)));
20
+ return words(normalizeForCase(deburr(str))).map((word) => word.toLowerCase()).join("_");
21
21
  }
22
22
  //#endregion
23
23
  export { snakeCase };
@@ -1,5 +1,5 @@
1
- const require_words = require("../../string/words.js");
2
1
  const require_deburr = require("./deburr.js");
2
+ const require_words = require("./words.js");
3
3
  const require_normalizeForCase = require("../_internal/normalizeForCase.js");
4
4
  //#region src/compat/string/startCase.ts
5
5
  /**
@@ -1,5 +1,5 @@
1
- import { words } from "../../string/words.mjs";
2
1
  import { deburr } from "./deburr.mjs";
2
+ import { words } from "./words.mjs";
3
3
  import { normalizeForCase } from "../_internal/normalizeForCase.mjs";
4
4
  //#region src/compat/string/startCase.ts
5
5
  /**
@@ -27,4 +27,4 @@ interface TemplateExecutor {
27
27
  }
28
28
  declare function template(string?: string, options?: TemplateOptions): TemplateExecutor;
29
29
  //#endregion
30
- export { template, templateSettings };
30
+ export { template };
@@ -27,4 +27,4 @@ interface TemplateExecutor {
27
27
  }
28
28
  declare function template(string?: string, options?: TemplateOptions): TemplateExecutor;
29
29
  //#endregion
30
- export { template, templateSettings };
30
+ export { template };
@@ -1 +1,18 @@
1
- import { templateSettings } from "./template.mjs";
1
+ import { escape } from "./escape.mjs";
2
+ import { template } from "./template.mjs";
3
+
4
+ //#region src/compat/string/templateSettings.d.ts
5
+ declare const templateSettings: {
6
+ escape: RegExp;
7
+ evaluate: RegExp;
8
+ interpolate: RegExp;
9
+ variable: string;
10
+ imports: {
11
+ _: {
12
+ escape: typeof escape;
13
+ template: typeof template;
14
+ };
15
+ };
16
+ };
17
+ //#endregion
18
+ export { templateSettings };
@@ -1 +1,18 @@
1
- import { templateSettings } from "./template.js";
1
+ import { escape } from "./escape.js";
2
+ import { template } from "./template.js";
3
+
4
+ //#region src/compat/string/templateSettings.d.ts
5
+ declare const templateSettings: {
6
+ escape: RegExp;
7
+ evaluate: RegExp;
8
+ interpolate: RegExp;
9
+ variable: string;
10
+ imports: {
11
+ _: {
12
+ escape: typeof escape;
13
+ template: typeof template;
14
+ };
15
+ };
16
+ };
17
+ //#endregion
18
+ export { templateSettings };
@@ -1 +1,4 @@
1
- require("./template.js");
1
+ //#region src/compat/string/templateSettings.ts
2
+ const templateSettings = require("./template.js").templateSettings;
3
+ //#endregion
4
+ exports.templateSettings = templateSettings;
@@ -1 +1,5 @@
1
- import "./template.mjs";
1
+ import { templateSettings as templateSettings$1 } from "./template.mjs";
2
+ //#region src/compat/string/templateSettings.ts
3
+ const templateSettings = templateSettings$1;
4
+ //#endregion
5
+ export { templateSettings };
@@ -1,14 +1,7 @@
1
1
  const require_isObject = require("../predicate/isObject.js");
2
+ const require_regexMultiByte = require("../_internal/regexMultiByte.js");
2
3
  //#region src/compat/string/truncate.ts
3
4
  /**
4
- * Used to compose unicode character classes.
5
- * @link https://github.com/lodash/lodash/blob/4.17.21-es/_hasUnicode.js
6
- *
7
- * Used to detect strings with zero-width joiners or code points from the astral planes.
8
- * @link http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/
9
- */
10
- const regexMultiByte = /[\u200d\ud800-\udfff\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff\ufe0e\ufe0f]/;
11
- /**
12
5
  * This regex might more completely detect unicode, but it is slower and this project
13
6
  * desires to mimic the behavior of lodash.
14
7
  */
@@ -46,7 +39,7 @@ function truncate(string, options) {
46
39
  const lengthOmission = Array.from(omission).length;
47
40
  const lengthBase = Math.max(length - lengthOmission, 0);
48
41
  let strArray = void 0;
49
- if (regexMultiByte.test(string)) {
42
+ if (require_regexMultiByte.regexMultiByte.test(string)) {
50
43
  strArray = Array.from(string);
51
44
  i = strArray.length;
52
45
  }