umt 2.16.0 → 2.18.0

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 (303) hide show
  1. package/README.md +344 -308
  2. package/module/Array/chunk.js.map +1 -1
  3. package/module/Array/uniqBy.js.map +1 -1
  4. package/module/Async/debounceAsync.d.ts +18 -0
  5. package/module/Async/debounceAsync.js +59 -0
  6. package/module/Async/debounceAsync.js.map +1 -0
  7. package/module/Async/index.d.ts +5 -0
  8. package/module/Async/index.js +5 -0
  9. package/module/Async/index.js.map +1 -1
  10. package/module/Async/pSettled.d.ts +19 -0
  11. package/module/Async/pSettled.js +54 -0
  12. package/module/Async/pSettled.js.map +1 -0
  13. package/module/Async/retry.d.ts +22 -0
  14. package/module/Async/retry.js +49 -0
  15. package/module/Async/retry.js.map +1 -0
  16. package/module/Async/throttleAsync.d.ts +18 -0
  17. package/module/Async/throttleAsync.js +41 -0
  18. package/module/Async/throttleAsync.js.map +1 -0
  19. package/module/Async/waitFor.d.ts +18 -0
  20. package/module/Async/waitFor.js +32 -0
  21. package/module/Async/waitFor.js.map +1 -0
  22. package/module/Date/addDuration.d.ts +15 -0
  23. package/module/Date/addDuration.js +40 -0
  24. package/module/Date/addDuration.js.map +1 -0
  25. package/module/Date/diff.d.ts +14 -0
  26. package/module/Date/diff.js +45 -0
  27. package/module/Date/diff.js.map +1 -0
  28. package/module/Date/durationUnit.d.ts +12 -0
  29. package/module/Date/durationUnit.js +2 -0
  30. package/module/Date/durationUnit.js.map +1 -0
  31. package/module/Date/endOf.d.ts +13 -0
  32. package/module/Date/endOf.js +58 -0
  33. package/module/Date/endOf.js.map +1 -0
  34. package/module/Date/formatRelative.d.ts +13 -0
  35. package/module/Date/formatRelative.js +35 -0
  36. package/module/Date/formatRelative.js.map +1 -0
  37. package/module/Date/index.d.ts +10 -0
  38. package/module/Date/index.js +10 -0
  39. package/module/Date/index.js.map +1 -1
  40. package/module/Date/isBusinessDay.d.ts +10 -0
  41. package/module/Date/isBusinessDay.js +18 -0
  42. package/module/Date/isBusinessDay.js.map +1 -0
  43. package/module/Date/isSameDay.d.ts +10 -0
  44. package/module/Date/isSameDay.js +13 -0
  45. package/module/Date/isSameDay.js.map +1 -0
  46. package/module/Date/isWeekend.d.ts +9 -0
  47. package/module/Date/isWeekend.js +13 -0
  48. package/module/Date/isWeekend.js.map +1 -0
  49. package/module/Date/msByUnit.d.ts +2 -0
  50. package/module/Date/msByUnit.js +10 -0
  51. package/module/Date/msByUnit.js.map +1 -0
  52. package/module/Date/startOf.d.ts +13 -0
  53. package/module/Date/startOf.js +58 -0
  54. package/module/Date/startOf.js.map +1 -0
  55. package/module/Date/subDuration.d.ts +13 -0
  56. package/module/Date/subDuration.js +14 -0
  57. package/module/Date/subDuration.js.map +1 -0
  58. package/module/Error/index.d.ts +0 -1
  59. package/module/Error/index.js +0 -1
  60. package/module/Error/index.js.map +1 -1
  61. package/module/Object/deepClone.js.map +1 -1
  62. package/module/Object/flattenObject.d.ts +11 -0
  63. package/module/Object/flattenObject.js +29 -0
  64. package/module/Object/flattenObject.js.map +1 -0
  65. package/module/Object/get.d.ts +1 -0
  66. package/module/Object/get.js +26 -0
  67. package/module/Object/get.js.map +1 -0
  68. package/module/Object/has.d.ts +0 -19
  69. package/module/Object/has.js +4 -4
  70. package/module/Object/has.js.map +1 -1
  71. package/module/Object/index.d.ts +8 -0
  72. package/module/Object/index.js +8 -0
  73. package/module/Object/index.js.map +1 -1
  74. package/module/Object/invert.d.ts +12 -0
  75. package/module/Object/invert.js +20 -0
  76. package/module/Object/invert.js.map +1 -0
  77. package/module/Object/mergeDeep.js.map +1 -1
  78. package/module/Object/omitBy.d.ts +11 -0
  79. package/module/Object/omitBy.js +21 -0
  80. package/module/Object/omitBy.js.map +1 -0
  81. package/module/Object/pathSegments.d.ts +1 -0
  82. package/module/Object/pathSegments.js +2 -0
  83. package/module/Object/pathSegments.js.map +1 -0
  84. package/module/Object/pickBy.d.ts +11 -0
  85. package/module/Object/pickBy.js +21 -0
  86. package/module/Object/pickBy.js.map +1 -0
  87. package/module/Object/set.d.ts +19 -0
  88. package/module/Object/set.js +38 -0
  89. package/module/Object/set.js.map +1 -0
  90. package/module/Object/unflattenObject.d.ts +15 -0
  91. package/module/Object/unflattenObject.js +23 -0
  92. package/module/Object/unflattenObject.js.map +1 -0
  93. package/module/Random/index.d.ts +7 -0
  94. package/module/Random/index.js +8 -0
  95. package/module/Random/index.js.map +1 -0
  96. package/module/Random/randomBoolean.d.ts +9 -0
  97. package/module/Random/randomBoolean.js +10 -0
  98. package/module/Random/randomBoolean.js.map +1 -0
  99. package/module/Random/randomChoice.d.ts +9 -0
  100. package/module/Random/randomChoice.js +13 -0
  101. package/module/Random/randomChoice.js.map +1 -0
  102. package/module/Random/randomFloat.d.ts +9 -0
  103. package/module/Random/randomFloat.js +10 -0
  104. package/module/Random/randomFloat.js.map +1 -0
  105. package/module/Random/randomInt.d.ts +9 -0
  106. package/module/Random/randomInt.js +14 -0
  107. package/module/Random/randomInt.js.map +1 -0
  108. package/module/Random/randomUuid.d.ts +9 -0
  109. package/module/Random/randomUuid.js +31 -0
  110. package/module/Random/randomUuid.js.map +1 -0
  111. package/module/Random/seededRandom.d.ts +11 -0
  112. package/module/Random/seededRandom.js +31 -0
  113. package/module/Random/seededRandom.js.map +1 -0
  114. package/module/Random/weightedChoice.d.ts +15 -0
  115. package/module/Random/weightedChoice.js +34 -0
  116. package/module/Random/weightedChoice.js.map +1 -0
  117. package/module/String/capitalize.d.ts +12 -0
  118. package/module/String/capitalize.js +18 -0
  119. package/module/String/capitalize.js.map +1 -0
  120. package/module/String/capitalizeWord.d.ts +1 -0
  121. package/module/String/capitalizeWord.js +2 -0
  122. package/module/String/capitalizeWord.js.map +1 -0
  123. package/module/String/dedent.d.ts +19 -0
  124. package/module/String/dedent.js +56 -0
  125. package/module/String/dedent.js.map +1 -0
  126. package/module/String/index.d.ts +10 -0
  127. package/module/String/index.js +10 -0
  128. package/module/String/index.js.map +1 -1
  129. package/module/String/mask.d.ts +20 -0
  130. package/module/String/mask.js +24 -0
  131. package/module/String/mask.js.map +1 -0
  132. package/module/String/pascalCase.d.ts +9 -0
  133. package/module/String/pascalCase.js +14 -0
  134. package/module/String/pascalCase.js.map +1 -0
  135. package/module/String/snakeCase.d.ts +9 -0
  136. package/module/String/snakeCase.js +13 -0
  137. package/module/String/snakeCase.js.map +1 -0
  138. package/module/String/titleCase.d.ts +9 -0
  139. package/module/String/titleCase.js +14 -0
  140. package/module/String/titleCase.js.map +1 -0
  141. package/module/String/uncapitalize.d.ts +10 -0
  142. package/module/String/uncapitalize.js +16 -0
  143. package/module/String/uncapitalize.js.map +1 -0
  144. package/module/String/wordCount.d.ts +10 -0
  145. package/module/String/wordCount.js +12 -0
  146. package/module/String/wordCount.js.map +1 -0
  147. package/module/String/words.d.ts +12 -0
  148. package/module/String/words.js +21 -0
  149. package/module/String/words.js.map +1 -0
  150. package/module/Tool/createPipeline.d.ts +1 -1
  151. package/module/Tool/createPipeline.js +8 -6
  152. package/module/Tool/createPipeline.js.map +1 -1
  153. package/module/Tool/pipe.js.map +1 -1
  154. package/module/URL/buildUrl.d.ts +10 -0
  155. package/module/URL/buildUrl.js +10 -4
  156. package/module/URL/buildUrl.js.map +1 -1
  157. package/module/URL/parseQueryString.d.ts +6 -0
  158. package/module/URL/parseQueryString.js +6 -4
  159. package/module/URL/parseQueryString.js.map +1 -1
  160. package/module/Validate/isNumber.js.map +1 -1
  161. package/module/Validate/object/core.js +0 -1
  162. package/module/Validate/object/core.js.map +1 -1
  163. package/module/Validate/object/index.d.ts +1 -0
  164. package/module/Validate/object/index.js +1 -0
  165. package/module/Validate/object/index.js.map +1 -1
  166. package/module/Validate/object/intersection.d.ts +4 -2
  167. package/module/Validate/object/intersection.js.map +1 -1
  168. package/module/Validate/object/nullable.d.ts +8 -0
  169. package/module/Validate/object/nullable.js +21 -0
  170. package/module/Validate/object/nullable.js.map +1 -0
  171. package/module/Validate/object/union.d.ts +4 -2
  172. package/module/Validate/object/union.js.map +1 -1
  173. package/module/Validate/string/index.d.ts +1 -0
  174. package/module/Validate/string/index.js +1 -0
  175. package/module/Validate/string/index.js.map +1 -1
  176. package/module/Validate/string/oneOf.d.ts +32 -0
  177. package/module/Validate/string/oneOf.js +32 -0
  178. package/module/Validate/string/oneOf.js.map +1 -0
  179. package/module/es5/Async/debounceAsync.d.ts +18 -0
  180. package/module/es5/Async/debounceAsync.js +103 -0
  181. package/module/es5/Async/index.d.ts +5 -0
  182. package/module/es5/Async/index.js +55 -0
  183. package/module/es5/Async/pSettled.d.ts +19 -0
  184. package/module/es5/Async/pSettled.js +68 -0
  185. package/module/es5/Async/retry.d.ts +22 -0
  186. package/module/es5/Async/retry.js +106 -0
  187. package/module/es5/Async/throttleAsync.d.ts +18 -0
  188. package/module/es5/Async/throttleAsync.js +46 -0
  189. package/module/es5/Async/waitFor.d.ts +18 -0
  190. package/module/es5/{Error/retry.js → Async/waitFor.js} +68 -74
  191. package/module/es5/Date/addDuration.d.ts +15 -0
  192. package/module/es5/Date/addDuration.js +45 -0
  193. package/module/es5/Date/diff.d.ts +14 -0
  194. package/module/es5/Date/diff.js +40 -0
  195. package/module/es5/Date/durationUnit.d.ts +12 -0
  196. package/module/es5/Date/durationUnit.js +5 -0
  197. package/module/es5/Date/endOf.d.ts +13 -0
  198. package/module/es5/Date/endOf.js +72 -0
  199. package/module/es5/Date/formatRelative.d.ts +13 -0
  200. package/module/es5/Date/formatRelative.js +61 -0
  201. package/module/es5/Date/index.d.ts +10 -0
  202. package/module/es5/Date/index.js +110 -0
  203. package/module/es5/Date/isBusinessDay.d.ts +10 -0
  204. package/module/es5/Date/isBusinessDay.js +26 -0
  205. package/module/es5/Date/isSameDay.d.ts +10 -0
  206. package/module/es5/Date/isSameDay.js +18 -0
  207. package/module/es5/Date/isWeekend.d.ts +9 -0
  208. package/module/es5/Date/isWeekend.js +18 -0
  209. package/module/es5/Date/msByUnit.d.ts +2 -0
  210. package/module/es5/Date/msByUnit.js +15 -0
  211. package/module/es5/Date/startOf.d.ts +13 -0
  212. package/module/es5/Date/startOf.js +72 -0
  213. package/module/es5/Date/subDuration.d.ts +13 -0
  214. package/module/es5/Date/subDuration.js +21 -0
  215. package/module/es5/Error/index.d.ts +0 -1
  216. package/module/es5/Error/index.js +0 -11
  217. package/module/es5/Object/flattenObject.d.ts +11 -0
  218. package/module/es5/Object/flattenObject.js +35 -0
  219. package/module/es5/Object/get.d.ts +1 -0
  220. package/module/es5/Object/get.js +42 -0
  221. package/module/es5/Object/has.d.ts +0 -19
  222. package/module/es5/Object/has.js +4 -4
  223. package/module/es5/Object/index.d.ts +8 -0
  224. package/module/es5/Object/index.js +88 -0
  225. package/module/es5/Object/invert.d.ts +12 -0
  226. package/module/es5/Object/invert.js +26 -0
  227. package/module/es5/Object/omitBy.d.ts +11 -0
  228. package/module/es5/Object/omitBy.js +27 -0
  229. package/module/es5/Object/pathSegments.d.ts +1 -0
  230. package/module/es5/Object/pathSegments.js +9 -0
  231. package/module/es5/Object/pickBy.d.ts +11 -0
  232. package/module/es5/Object/pickBy.js +27 -0
  233. package/module/es5/Object/set.d.ts +19 -0
  234. package/module/es5/Object/set.js +44 -0
  235. package/module/es5/Object/unflattenObject.d.ts +15 -0
  236. package/module/es5/Object/unflattenObject.js +30 -0
  237. package/module/es5/Random/index.d.ts +7 -0
  238. package/module/es5/Random/index.js +82 -0
  239. package/module/es5/Random/randomBoolean.d.ts +9 -0
  240. package/module/es5/Random/randomBoolean.js +18 -0
  241. package/module/es5/Random/randomChoice.d.ts +9 -0
  242. package/module/es5/Random/randomChoice.js +18 -0
  243. package/module/es5/Random/randomFloat.d.ts +9 -0
  244. package/module/es5/Random/randomFloat.js +17 -0
  245. package/module/es5/Random/randomInt.d.ts +9 -0
  246. package/module/es5/Random/randomInt.js +19 -0
  247. package/module/es5/Random/randomUuid.d.ts +9 -0
  248. package/module/es5/Random/randomUuid.js +38 -0
  249. package/module/es5/Random/seededRandom.d.ts +11 -0
  250. package/module/es5/Random/seededRandom.js +46 -0
  251. package/module/es5/Random/weightedChoice.d.ts +15 -0
  252. package/module/es5/Random/weightedChoice.js +50 -0
  253. package/module/es5/String/capitalize.d.ts +12 -0
  254. package/module/es5/String/capitalize.js +35 -0
  255. package/module/es5/String/capitalizeWord.d.ts +1 -0
  256. package/module/es5/String/capitalizeWord.js +9 -0
  257. package/module/es5/String/dedent.d.ts +19 -0
  258. package/module/es5/String/dedent.js +82 -0
  259. package/module/es5/String/index.d.ts +10 -0
  260. package/module/es5/String/index.js +110 -0
  261. package/module/es5/String/mask.d.ts +20 -0
  262. package/module/es5/String/mask.js +39 -0
  263. package/module/es5/String/pascalCase.d.ts +9 -0
  264. package/module/es5/String/pascalCase.js +21 -0
  265. package/module/es5/String/snakeCase.d.ts +9 -0
  266. package/module/es5/String/snakeCase.js +20 -0
  267. package/module/es5/String/titleCase.d.ts +9 -0
  268. package/module/es5/String/titleCase.js +21 -0
  269. package/module/es5/String/uncapitalize.d.ts +10 -0
  270. package/module/es5/String/uncapitalize.js +33 -0
  271. package/module/es5/String/wordCount.d.ts +10 -0
  272. package/module/es5/String/wordCount.js +19 -0
  273. package/module/es5/String/words.d.ts +12 -0
  274. package/module/es5/String/words.js +25 -0
  275. package/module/es5/Tool/createPipeline.d.ts +1 -1
  276. package/module/es5/Tool/createPipeline.js +7 -10
  277. package/module/es5/URL/buildUrl.d.ts +10 -0
  278. package/module/es5/URL/buildUrl.js +10 -4
  279. package/module/es5/URL/parseQueryString.d.ts +6 -0
  280. package/module/es5/URL/parseQueryString.js +6 -4
  281. package/module/es5/Validate/object/core.js +0 -1
  282. package/module/es5/Validate/object/index.d.ts +1 -0
  283. package/module/es5/Validate/object/index.js +11 -0
  284. package/module/es5/Validate/object/intersection.d.ts +4 -2
  285. package/module/es5/Validate/object/intersection.js +6 -0
  286. package/module/es5/Validate/object/nullable.d.ts +8 -0
  287. package/module/es5/Validate/object/nullable.js +26 -0
  288. package/module/es5/Validate/object/union.d.ts +4 -2
  289. package/module/es5/Validate/object/union.js +6 -0
  290. package/module/es5/Validate/string/index.d.ts +1 -0
  291. package/module/es5/Validate/string/index.js +11 -0
  292. package/module/es5/Validate/string/oneOf.d.ts +32 -0
  293. package/module/es5/Validate/string/oneOf.js +45 -0
  294. package/module/es5/index.d.ts +1 -0
  295. package/module/es5/index.js +20 -9
  296. package/module/index.d.ts +1 -0
  297. package/module/index.js +1 -0
  298. package/module/index.js.map +1 -1
  299. package/package.json +33 -25
  300. package/module/Error/retry.d.ts +0 -37
  301. package/module/Error/retry.js +0 -47
  302. package/module/Error/retry.js.map +0 -1
  303. package/module/es5/Error/retry.d.ts +0 -37
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Returns true when two dates represent the same calendar day in local time.
3
+ * @param {Date} left - First date
4
+ * @param {Date} right - Second date
5
+ * @returns {boolean} True if same year/month/day in local time
6
+ * @example
7
+ * isSameDay(new Date("2025-04-15T01:00"), new Date("2025-04-15T23:00")); // true
8
+ * isSameDay(new Date("2025-04-15"), new Date("2025-04-16")); // false
9
+ */
10
+ export declare const isSameDay: (left: Date, right: Date) => boolean;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.isSameDay = void 0;
7
+ /**
8
+ * Returns true when two dates represent the same calendar day in local time.
9
+ * @param {Date} left - First date
10
+ * @param {Date} right - Second date
11
+ * @returns {boolean} True if same year/month/day in local time
12
+ * @example
13
+ * isSameDay(new Date("2025-04-15T01:00"), new Date("2025-04-15T23:00")); // true
14
+ * isSameDay(new Date("2025-04-15"), new Date("2025-04-16")); // false
15
+ */
16
+ var isSameDay = exports.isSameDay = function isSameDay(left, right) {
17
+ return left.getFullYear() === right.getFullYear() && left.getMonth() === right.getMonth() && left.getDate() === right.getDate();
18
+ };
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Returns true when the given date is Saturday or Sunday.
3
+ * @param {Date} date - The date to check
4
+ * @returns {boolean} True if Saturday or Sunday, false otherwise
5
+ * @example
6
+ * isWeekend(new Date("2025-04-19")); // true (Saturday)
7
+ * isWeekend(new Date("2025-04-21")); // false (Monday)
8
+ */
9
+ export declare const isWeekend: (date: Date) => boolean;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.isWeekend = void 0;
7
+ /**
8
+ * Returns true when the given date is Saturday or Sunday.
9
+ * @param {Date} date - The date to check
10
+ * @returns {boolean} True if Saturday or Sunday, false otherwise
11
+ * @example
12
+ * isWeekend(new Date("2025-04-19")); // true (Saturday)
13
+ * isWeekend(new Date("2025-04-21")); // false (Monday)
14
+ */
15
+ var isWeekend = exports.isWeekend = function isWeekend(date) {
16
+ var dayOfWeek = date.getDay();
17
+ return dayOfWeek === 0 || dayOfWeek === 6;
18
+ };
@@ -0,0 +1,2 @@
1
+ import type { DurationUnit } from "./durationUnit";
2
+ export declare const msByUnit: Partial<Record<DurationUnit, number>>;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.msByUnit = void 0;
7
+ var _clock = require("../Consts/clock");
8
+ var msByUnit = exports.msByUnit = {
9
+ ms: 1,
10
+ s: _clock.OneSecondMs,
11
+ m: _clock.OneMinuteMs,
12
+ h: _clock.OneHourMs,
13
+ d: _clock.OneDayMs,
14
+ w: _clock.OneWeekMs
15
+ };
@@ -0,0 +1,13 @@
1
+ export type DateBoundaryUnit = "second" | "minute" | "hour" | "day" | "week" | "month" | "quarter" | "year";
2
+ /**
3
+ * Returns a new Date set to the start of the given unit.
4
+ * Week start is Sunday (day 0).
5
+ *
6
+ * @param {Date} date - Base date
7
+ * @param {DateBoundaryUnit} unit - Boundary unit
8
+ * @returns {Date} A new Date at the start of the specified unit
9
+ * @example
10
+ * startOf(new Date("2025-04-15T10:30:00"), "day"); // 2025-04-15T00:00:00
11
+ * startOf(new Date("2025-04-15"), "month"); // 2025-04-01T00:00:00
12
+ */
13
+ export declare const startOf: (date: Date, unit: DateBoundaryUnit) => Date;
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.startOf = void 0;
7
+ /**
8
+ * Returns a new Date set to the start of the given unit.
9
+ * Week start is Sunday (day 0).
10
+ *
11
+ * @param {Date} date - Base date
12
+ * @param {DateBoundaryUnit} unit - Boundary unit
13
+ * @returns {Date} A new Date at the start of the specified unit
14
+ * @example
15
+ * startOf(new Date("2025-04-15T10:30:00"), "day"); // 2025-04-15T00:00:00
16
+ * startOf(new Date("2025-04-15"), "month"); // 2025-04-01T00:00:00
17
+ */
18
+ var startOf = exports.startOf = function startOf(date, unit) {
19
+ var result = new Date(date);
20
+ switch (unit) {
21
+ case "second":
22
+ {
23
+ result.setMilliseconds(0);
24
+ return result;
25
+ }
26
+ case "minute":
27
+ {
28
+ result.setSeconds(0, 0);
29
+ return result;
30
+ }
31
+ case "hour":
32
+ {
33
+ result.setMinutes(0, 0, 0);
34
+ return result;
35
+ }
36
+ case "day":
37
+ {
38
+ result.setHours(0, 0, 0, 0);
39
+ return result;
40
+ }
41
+ case "week":
42
+ {
43
+ var dayOfWeek = result.getDay();
44
+ result.setDate(result.getDate() - dayOfWeek);
45
+ result.setHours(0, 0, 0, 0);
46
+ return result;
47
+ }
48
+ case "month":
49
+ {
50
+ result.setDate(1);
51
+ result.setHours(0, 0, 0, 0);
52
+ return result;
53
+ }
54
+ case "quarter":
55
+ {
56
+ var quarterStartMonth = Math.floor(result.getMonth() / 3) * 3;
57
+ result.setMonth(quarterStartMonth, 1);
58
+ result.setHours(0, 0, 0, 0);
59
+ return result;
60
+ }
61
+ case "year":
62
+ {
63
+ result.setMonth(0, 1);
64
+ result.setHours(0, 0, 0, 0);
65
+ return result;
66
+ }
67
+ default:
68
+ {
69
+ return result;
70
+ }
71
+ }
72
+ };
@@ -0,0 +1,13 @@
1
+ import type { DurationUnit } from "./durationUnit";
2
+ /**
3
+ * Subtracts a duration from a date and returns a new Date.
4
+ * Equivalent to addDuration(date, -amount, unit).
5
+ *
6
+ * @param {Date} date - Base date
7
+ * @param {number} amount - Amount to subtract
8
+ * @param {DurationUnit} unit - Unit of the amount
9
+ * @returns {Date} A new Date with the duration subtracted
10
+ * @example
11
+ * subDuration(new Date("2025-03-31"), 1, "M"); // 2025-02-28
12
+ */
13
+ export declare const subDuration: (date: Date, amount: number, unit: DurationUnit) => Date;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.subDuration = void 0;
7
+ var _addDuration = require("./addDuration");
8
+ /**
9
+ * Subtracts a duration from a date and returns a new Date.
10
+ * Equivalent to addDuration(date, -amount, unit).
11
+ *
12
+ * @param {Date} date - Base date
13
+ * @param {number} amount - Amount to subtract
14
+ * @param {DurationUnit} unit - Unit of the amount
15
+ * @returns {Date} A new Date with the duration subtracted
16
+ * @example
17
+ * subDuration(new Date("2025-03-31"), 1, "M"); // 2025-02-28
18
+ */
19
+ var subDuration = exports.subDuration = function subDuration(date, amount, unit) {
20
+ return (0, _addDuration.addDuration)(date, -amount, unit);
21
+ };
@@ -1,5 +1,4 @@
1
1
  export * from "./flatMapResult";
2
2
  export * from "./mapResult";
3
3
  export * from "./matchResult";
4
- export * from "./retry";
5
4
  export * from "./safeExecute";
@@ -36,17 +36,6 @@ Object.keys(_matchResult).forEach(function (key) {
36
36
  }
37
37
  });
38
38
  });
39
- var _retry = require("./retry");
40
- Object.keys(_retry).forEach(function (key) {
41
- if (key === "default" || key === "__esModule") return;
42
- if (key in exports && exports[key] === _retry[key]) return;
43
- Object.defineProperty(exports, key, {
44
- enumerable: true,
45
- get: function get() {
46
- return _retry[key];
47
- }
48
- });
49
- });
50
39
  var _safeExecute = require("./safeExecute");
51
40
  Object.keys(_safeExecute).forEach(function (key) {
52
41
  if (key === "default" || key === "__esModule") return;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Recursively flattens a nested plain object into a single-level object
3
+ * keyed by joined paths. Arrays and non-plain objects are kept as-is.
4
+ *
5
+ * @param {Record<string, unknown>} object - Source nested object
6
+ * @param {string} [separator="."] - Separator used to join path segments
7
+ * @returns {Record<string, unknown>} A flat object
8
+ * @example
9
+ * flattenObject({ a: { b: { c: 1 } }, d: 2 }); // { "a.b.c": 1, d: 2 }
10
+ */
11
+ export declare const flattenObject: <T extends Record<string, unknown>>(object: T, separator?: string) => Record<string, unknown>;
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.flattenObject = void 0;
7
+ var _isPlainObject = require("./isPlainObject");
8
+ /**
9
+ * Recursively flattens a nested plain object into a single-level object
10
+ * keyed by joined paths. Arrays and non-plain objects are kept as-is.
11
+ *
12
+ * @param {Record<string, unknown>} object - Source nested object
13
+ * @param {string} [separator="."] - Separator used to join path segments
14
+ * @returns {Record<string, unknown>} A flat object
15
+ * @example
16
+ * flattenObject({ a: { b: { c: 1 } }, d: 2 }); // { "a.b.c": 1, d: 2 }
17
+ */
18
+ var flattenObject = exports.flattenObject = function flattenObject(object) {
19
+ var separator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ".";
20
+ var result = {};
21
+ var _walk = function walk(current, prefix) {
22
+ for (var _i = 0, _Object$keys = Object.keys(current); _i < _Object$keys.length; _i++) {
23
+ var key = _Object$keys[_i];
24
+ var value = current[key];
25
+ var nextKey = prefix ? "".concat(prefix).concat(separator).concat(key) : key;
26
+ if ((0, _isPlainObject.isPlainObject)(value) && Object.keys(value).length > 0) {
27
+ _walk(value, nextKey);
28
+ } else {
29
+ result[nextKey] = value;
30
+ }
31
+ }
32
+ };
33
+ _walk(object, "");
34
+ return result;
35
+ };
@@ -0,0 +1 @@
1
+ export declare const get: <T>(object: unknown, path: string | string[], defaultValue?: T) => T | undefined;
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.get = void 0;
7
+ var _pathSegments = require("./pathSegments");
8
+ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
9
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
10
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; } /**
11
+ * Reads a deeply nested property by string or string-array path.
12
+ * Returns the default value if any segment is missing.
13
+ *
14
+ * @template T - Expected return type
15
+ * @param {unknown} object - Source object
16
+ * @param {string | string[]} path - Dot-separated string or path segments array
17
+ * @param {T} [defaultValue] - Returned when the path resolves to undefined or is missing
18
+ * @returns {T | undefined} The resolved value, or defaultValue when missing
19
+ * @example
20
+ * get({ a: { b: { c: 1 } } }, "a.b.c"); // 1
21
+ * get({ a: { b: 1 } }, ["a", "x"], 0); // 0
22
+ */
23
+ var get = exports.get = function get(object, path, defaultValue) {
24
+ var segments = (0, _pathSegments.pathSegments)(path);
25
+ var current = object;
26
+ var _iterator = _createForOfIteratorHelper(segments),
27
+ _step;
28
+ try {
29
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
30
+ var key = _step.value;
31
+ if (current == null) {
32
+ return defaultValue;
33
+ }
34
+ current = current[key];
35
+ }
36
+ } catch (err) {
37
+ _iterator.e(err);
38
+ } finally {
39
+ _iterator.f();
40
+ }
41
+ return current === undefined ? defaultValue : current;
42
+ };
@@ -1,22 +1,3 @@
1
- /**
2
- * Determines if an object has a specified path
3
- * @param {T} object - Object to check
4
- * @param {string | string[]} path - Path to check
5
- * @returns {boolean} Returns true if path exists, false otherwise
6
- * @example has({ a: { b: 1 } }, "a.b"); // true
7
- * has({ a: { b: 1 } }, ["a", "b"]); // true
8
- * has({ a: { b: 1 } }, "a.c"); // false
9
- *
10
- * @remarks
11
- * **Prototype pollution warning:** This function does not filter out
12
- * prototype-polluting keys (`__proto__`, `constructor`, `prototype`).
13
- * If processing user-controlled input, sanitize with the appropriate
14
- * `removePrototype*` helper before calling this function:
15
- * - `removePrototype` — shallow sanitization of a single object
16
- * - `removePrototypeDeep` — recursive sanitization of a single object (for deeply nested data)
17
- * - `removePrototypeMap` — shallow sanitization of an array of objects
18
- * - `removePrototypeMapDeep` — recursive sanitization of an array of objects (for deeply nested data)
19
- */
20
1
  export declare const has: <T extends {
21
2
  [key: string]: unknown;
22
3
  }>(object: T, path: string | string[]) => boolean;
@@ -4,10 +4,10 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.has = void 0;
7
+ var _pathSegments = require("./pathSegments");
7
8
  function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
8
9
  function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
9
- function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
10
- /**
10
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; } /**
11
11
  * Determines if an object has a specified path
12
12
  * @param {T} object - Object to check
13
13
  * @param {string | string[]} path - Path to check
@@ -27,9 +27,9 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
27
27
  * - `removePrototypeMapDeep` — recursive sanitization of an array of objects (for deeply nested data)
28
28
  */
29
29
  var has = exports.has = function has(object, path) {
30
- var localPath = typeof path === "string" ? path.split(".") : path;
30
+ var segments = (0, _pathSegments.pathSegments)(path);
31
31
  var current = object;
32
- var _iterator = _createForOfIteratorHelper(localPath),
32
+ var _iterator = _createForOfIteratorHelper(segments),
33
33
  _step;
34
34
  try {
35
35
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
@@ -1,7 +1,10 @@
1
1
  export * from "./deepClone";
2
+ export * from "./flattenObject";
3
+ export * from "./get";
2
4
  export * from "./getObjectsCommon";
3
5
  export * from "./getObjectsDiff";
4
6
  export * from "./has";
7
+ export * from "./invert";
5
8
  export * from "./isEmpty";
6
9
  export * from "./isPlainObject";
7
10
  export * from "./keyBy";
@@ -10,9 +13,14 @@ export * from "./mapValues";
10
13
  export * from "./merge";
11
14
  export * from "./mergeDeep";
12
15
  export * from "./omit";
16
+ export * from "./omitBy";
17
+ export * from "./pathSegments";
13
18
  export * from "./pick";
19
+ export * from "./pickBy";
14
20
  export * from "./pickDeep";
15
21
  export * from "./removePrototype";
16
22
  export * from "./removePrototypeDeep";
17
23
  export * from "./removePrototypeMap";
18
24
  export * from "./removePrototypeMapDeep";
25
+ export * from "./set";
26
+ export * from "./unflattenObject";
@@ -14,6 +14,28 @@ Object.keys(_deepClone).forEach(function (key) {
14
14
  }
15
15
  });
16
16
  });
17
+ var _flattenObject = require("./flattenObject");
18
+ Object.keys(_flattenObject).forEach(function (key) {
19
+ if (key === "default" || key === "__esModule") return;
20
+ if (key in exports && exports[key] === _flattenObject[key]) return;
21
+ Object.defineProperty(exports, key, {
22
+ enumerable: true,
23
+ get: function get() {
24
+ return _flattenObject[key];
25
+ }
26
+ });
27
+ });
28
+ var _get = require("./get");
29
+ Object.keys(_get).forEach(function (key) {
30
+ if (key === "default" || key === "__esModule") return;
31
+ if (key in exports && exports[key] === _get[key]) return;
32
+ Object.defineProperty(exports, key, {
33
+ enumerable: true,
34
+ get: function get() {
35
+ return _get[key];
36
+ }
37
+ });
38
+ });
17
39
  var _getObjectsCommon = require("./getObjectsCommon");
18
40
  Object.keys(_getObjectsCommon).forEach(function (key) {
19
41
  if (key === "default" || key === "__esModule") return;
@@ -47,6 +69,17 @@ Object.keys(_has).forEach(function (key) {
47
69
  }
48
70
  });
49
71
  });
72
+ var _invert = require("./invert");
73
+ Object.keys(_invert).forEach(function (key) {
74
+ if (key === "default" || key === "__esModule") return;
75
+ if (key in exports && exports[key] === _invert[key]) return;
76
+ Object.defineProperty(exports, key, {
77
+ enumerable: true,
78
+ get: function get() {
79
+ return _invert[key];
80
+ }
81
+ });
82
+ });
50
83
  var _isEmpty = require("./isEmpty");
51
84
  Object.keys(_isEmpty).forEach(function (key) {
52
85
  if (key === "default" || key === "__esModule") return;
@@ -135,6 +168,28 @@ Object.keys(_omit).forEach(function (key) {
135
168
  }
136
169
  });
137
170
  });
171
+ var _omitBy = require("./omitBy");
172
+ Object.keys(_omitBy).forEach(function (key) {
173
+ if (key === "default" || key === "__esModule") return;
174
+ if (key in exports && exports[key] === _omitBy[key]) return;
175
+ Object.defineProperty(exports, key, {
176
+ enumerable: true,
177
+ get: function get() {
178
+ return _omitBy[key];
179
+ }
180
+ });
181
+ });
182
+ var _pathSegments = require("./pathSegments");
183
+ Object.keys(_pathSegments).forEach(function (key) {
184
+ if (key === "default" || key === "__esModule") return;
185
+ if (key in exports && exports[key] === _pathSegments[key]) return;
186
+ Object.defineProperty(exports, key, {
187
+ enumerable: true,
188
+ get: function get() {
189
+ return _pathSegments[key];
190
+ }
191
+ });
192
+ });
138
193
  var _pick = require("./pick");
139
194
  Object.keys(_pick).forEach(function (key) {
140
195
  if (key === "default" || key === "__esModule") return;
@@ -146,6 +201,17 @@ Object.keys(_pick).forEach(function (key) {
146
201
  }
147
202
  });
148
203
  });
204
+ var _pickBy = require("./pickBy");
205
+ Object.keys(_pickBy).forEach(function (key) {
206
+ if (key === "default" || key === "__esModule") return;
207
+ if (key in exports && exports[key] === _pickBy[key]) return;
208
+ Object.defineProperty(exports, key, {
209
+ enumerable: true,
210
+ get: function get() {
211
+ return _pickBy[key];
212
+ }
213
+ });
214
+ });
149
215
  var _pickDeep = require("./pickDeep");
150
216
  Object.keys(_pickDeep).forEach(function (key) {
151
217
  if (key === "default" || key === "__esModule") return;
@@ -200,4 +266,26 @@ Object.keys(_removePrototypeMapDeep).forEach(function (key) {
200
266
  return _removePrototypeMapDeep[key];
201
267
  }
202
268
  });
269
+ });
270
+ var _set = require("./set");
271
+ Object.keys(_set).forEach(function (key) {
272
+ if (key === "default" || key === "__esModule") return;
273
+ if (key in exports && exports[key] === _set[key]) return;
274
+ Object.defineProperty(exports, key, {
275
+ enumerable: true,
276
+ get: function get() {
277
+ return _set[key];
278
+ }
279
+ });
280
+ });
281
+ var _unflattenObject = require("./unflattenObject");
282
+ Object.keys(_unflattenObject).forEach(function (key) {
283
+ if (key === "default" || key === "__esModule") return;
284
+ if (key in exports && exports[key] === _unflattenObject[key]) return;
285
+ Object.defineProperty(exports, key, {
286
+ enumerable: true,
287
+ get: function get() {
288
+ return _unflattenObject[key];
289
+ }
290
+ });
203
291
  });
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Creates a new object with keys and values swapped.
3
+ * If multiple keys share the same value, later entries overwrite earlier ones.
4
+ *
5
+ * @template K - Key type of the input object (must be a PropertyKey)
6
+ * @template V - Value type of the input object (must be a PropertyKey)
7
+ * @param {Record<K, V>} object - Source object
8
+ * @returns {Record<V, K>} A new object with keys and values swapped
9
+ * @example
10
+ * invert({ a: 1, b: 2 }); // { 1: "a", 2: "b" }
11
+ */
12
+ export declare const invert: <K extends PropertyKey, V extends PropertyKey>(object: Record<K, V>) => Record<V, K>;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.invert = void 0;
7
+ /**
8
+ * Creates a new object with keys and values swapped.
9
+ * If multiple keys share the same value, later entries overwrite earlier ones.
10
+ *
11
+ * @template K - Key type of the input object (must be a PropertyKey)
12
+ * @template V - Value type of the input object (must be a PropertyKey)
13
+ * @param {Record<K, V>} object - Source object
14
+ * @returns {Record<V, K>} A new object with keys and values swapped
15
+ * @example
16
+ * invert({ a: 1, b: 2 }); // { 1: "a", 2: "b" }
17
+ */
18
+ var invert = exports.invert = function invert(object) {
19
+ var result = {};
20
+ for (var _i = 0, _arr = Object.keys(object); _i < _arr.length; _i++) {
21
+ var key = _arr[_i];
22
+ var value = object[key];
23
+ result[value] = key;
24
+ }
25
+ return result;
26
+ };
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Creates a new object containing only entries for which the predicate returns false.
3
+ *
4
+ * @template T - Type of the source object
5
+ * @param {T} object - Source object
6
+ * @param {(value: T[keyof T], key: keyof T) => boolean} predicate - Rejection predicate
7
+ * @returns {Partial<T>} A new object with the remaining entries
8
+ * @example
9
+ * omitBy({ a: 1, b: undefined, c: 3 }, (v) => v === undefined); // { a: 1, c: 3 }
10
+ */
11
+ export declare const omitBy: <T extends Record<string, unknown>>(object: T, predicate: (value: T[keyof T], key: keyof T) => boolean) => Partial<T>;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.omitBy = void 0;
7
+ /**
8
+ * Creates a new object containing only entries for which the predicate returns false.
9
+ *
10
+ * @template T - Type of the source object
11
+ * @param {T} object - Source object
12
+ * @param {(value: T[keyof T], key: keyof T) => boolean} predicate - Rejection predicate
13
+ * @returns {Partial<T>} A new object with the remaining entries
14
+ * @example
15
+ * omitBy({ a: 1, b: undefined, c: 3 }, (v) => v === undefined); // { a: 1, c: 3 }
16
+ */
17
+ var omitBy = exports.omitBy = function omitBy(object, predicate) {
18
+ var result = {};
19
+ for (var _i = 0, _arr = Object.keys(object); _i < _arr.length; _i++) {
20
+ var key = _arr[_i];
21
+ var value = object[key];
22
+ if (!predicate(value, key)) {
23
+ result[key] = value;
24
+ }
25
+ }
26
+ return result;
27
+ };
@@ -0,0 +1 @@
1
+ export declare const pathSegments: (path: string | string[]) => string[];
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.pathSegments = void 0;
7
+ var pathSegments = exports.pathSegments = function pathSegments(path) {
8
+ return typeof path === "string" ? path.split(".") : path;
9
+ };
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Creates a new object containing only entries for which the predicate returns true.
3
+ *
4
+ * @template T - Type of the source object
5
+ * @param {T} object - Source object
6
+ * @param {(value: T[keyof T], key: keyof T) => boolean} predicate - Selector predicate
7
+ * @returns {Partial<T>} A new object with the filtered entries
8
+ * @example
9
+ * pickBy({ a: 1, b: 2, c: 3 }, (v) => v > 1); // { b: 2, c: 3 }
10
+ */
11
+ export declare const pickBy: <T extends Record<string, unknown>>(object: T, predicate: (value: T[keyof T], key: keyof T) => boolean) => Partial<T>;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.pickBy = void 0;
7
+ /**
8
+ * Creates a new object containing only entries for which the predicate returns true.
9
+ *
10
+ * @template T - Type of the source object
11
+ * @param {T} object - Source object
12
+ * @param {(value: T[keyof T], key: keyof T) => boolean} predicate - Selector predicate
13
+ * @returns {Partial<T>} A new object with the filtered entries
14
+ * @example
15
+ * pickBy({ a: 1, b: 2, c: 3 }, (v) => v > 1); // { b: 2, c: 3 }
16
+ */
17
+ var pickBy = exports.pickBy = function pickBy(object, predicate) {
18
+ var result = {};
19
+ for (var _i = 0, _arr = Object.keys(object); _i < _arr.length; _i++) {
20
+ var key = _arr[_i];
21
+ var value = object[key];
22
+ if (predicate(value, key)) {
23
+ result[key] = value;
24
+ }
25
+ }
26
+ return result;
27
+ };