@duplojs/utils 1.1.16 → 1.2.17

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 (482) hide show
  1. package/dist/array/index.cjs +28 -28
  2. package/dist/array/index.mjs +14 -14
  3. package/dist/array/reduce.cjs +0 -2
  4. package/dist/array/reduce.mjs +0 -2
  5. package/dist/array/reduceRight.cjs +0 -2
  6. package/dist/array/reduceRight.mjs +0 -2
  7. package/dist/array/types/extractTuple.d.ts +1 -1
  8. package/dist/common/asyncInnerPipe.d.ts +16 -11
  9. package/dist/common/asyncPipe.d.ts +16 -11
  10. package/dist/common/builder.cjs +5 -11
  11. package/dist/common/builder.d.ts +7 -7
  12. package/dist/common/builder.mjs +4 -10
  13. package/dist/common/createKindIdentifier.cjs +1 -3
  14. package/dist/common/createKindIdentifier.mjs +1 -3
  15. package/dist/common/equal.d.ts +4 -4
  16. package/dist/common/errorKindNamespace.cjs +9 -0
  17. package/dist/common/errorKindNamespace.d.ts +1 -0
  18. package/dist/common/errorKindNamespace.mjs +7 -0
  19. package/dist/common/forwardLog.cjs +8 -0
  20. package/dist/common/forwardLog.d.ts +1 -0
  21. package/dist/common/forwardLog.mjs +6 -0
  22. package/dist/common/index.d.ts +3 -0
  23. package/dist/common/innerPipe.d.ts +16 -11
  24. package/dist/common/instanceOf.cjs +0 -2
  25. package/dist/common/instanceOf.mjs +0 -2
  26. package/dist/common/kind.d.ts +1 -0
  27. package/dist/common/override.cjs +36 -0
  28. package/dist/common/override.d.ts +18 -0
  29. package/dist/common/override.mjs +34 -0
  30. package/dist/common/pipe.d.ts +16 -11
  31. package/dist/common/stringToBytes.cjs +4 -9
  32. package/dist/common/stringToBytes.d.ts +4 -4
  33. package/dist/common/stringToBytes.mjs +4 -9
  34. package/dist/common/stringToMillisecond.cjs +4 -9
  35. package/dist/common/stringToMillisecond.d.ts +4 -4
  36. package/dist/common/stringToMillisecond.mjs +4 -9
  37. package/dist/common/types/objectEntry.d.ts +1 -1
  38. package/dist/dataParser/base.cjs +7 -6
  39. package/dist/dataParser/base.d.ts +3 -0
  40. package/dist/dataParser/base.mjs +7 -6
  41. package/dist/dataParser/baseExtended.cjs +12 -14
  42. package/dist/dataParser/baseExtended.d.ts +3 -0
  43. package/dist/dataParser/baseExtended.mjs +12 -14
  44. package/dist/dataParser/extended/array.cjs +4 -5
  45. package/dist/dataParser/extended/array.d.ts +3 -0
  46. package/dist/dataParser/extended/array.mjs +4 -5
  47. package/dist/dataParser/extended/bigint.cjs +4 -5
  48. package/dist/dataParser/extended/bigint.d.ts +3 -0
  49. package/dist/dataParser/extended/bigint.mjs +4 -5
  50. package/dist/dataParser/extended/boolean.cjs +4 -5
  51. package/dist/dataParser/extended/boolean.d.ts +3 -0
  52. package/dist/dataParser/extended/boolean.mjs +4 -5
  53. package/dist/dataParser/extended/coerce/bigint.cjs +0 -4
  54. package/dist/dataParser/extended/coerce/bigint.mjs +0 -4
  55. package/dist/dataParser/extended/coerce/boolean.cjs +0 -4
  56. package/dist/dataParser/extended/coerce/boolean.mjs +0 -4
  57. package/dist/dataParser/extended/coerce/date.cjs +12 -0
  58. package/dist/dataParser/extended/coerce/date.d.ts +7 -0
  59. package/dist/dataParser/extended/coerce/date.mjs +10 -0
  60. package/dist/dataParser/extended/coerce/empty.cjs +0 -4
  61. package/dist/dataParser/extended/coerce/empty.mjs +0 -4
  62. package/dist/dataParser/extended/coerce/index.cjs +2 -0
  63. package/dist/dataParser/extended/coerce/index.d.ts +1 -0
  64. package/dist/dataParser/extended/coerce/index.mjs +1 -0
  65. package/dist/dataParser/extended/coerce/nil.cjs +0 -4
  66. package/dist/dataParser/extended/coerce/nil.mjs +0 -4
  67. package/dist/dataParser/extended/coerce/number.cjs +0 -4
  68. package/dist/dataParser/extended/coerce/number.mjs +0 -4
  69. package/dist/dataParser/extended/coerce/string.cjs +0 -4
  70. package/dist/dataParser/extended/coerce/string.mjs +0 -4
  71. package/dist/dataParser/extended/date.cjs +13 -0
  72. package/dist/dataParser/extended/date.d.ts +23 -0
  73. package/dist/dataParser/extended/date.mjs +11 -0
  74. package/dist/dataParser/extended/empty.cjs +4 -5
  75. package/dist/dataParser/extended/empty.d.ts +3 -0
  76. package/dist/dataParser/extended/empty.mjs +4 -5
  77. package/dist/dataParser/extended/index.cjs +15 -0
  78. package/dist/dataParser/extended/index.d.ts +3 -0
  79. package/dist/dataParser/extended/index.mjs +2 -0
  80. package/dist/dataParser/extended/lazy.cjs +4 -5
  81. package/dist/dataParser/extended/lazy.d.ts +3 -0
  82. package/dist/dataParser/extended/lazy.mjs +4 -5
  83. package/dist/dataParser/extended/literal.cjs +4 -5
  84. package/dist/dataParser/extended/literal.d.ts +3 -0
  85. package/dist/dataParser/extended/literal.mjs +4 -5
  86. package/dist/dataParser/extended/nil.cjs +4 -5
  87. package/dist/dataParser/extended/nil.d.ts +3 -0
  88. package/dist/dataParser/extended/nil.mjs +4 -5
  89. package/dist/dataParser/extended/nullable.cjs +4 -5
  90. package/dist/dataParser/extended/nullable.d.ts +3 -0
  91. package/dist/dataParser/extended/nullable.mjs +4 -5
  92. package/dist/dataParser/extended/number.cjs +4 -5
  93. package/dist/dataParser/extended/number.d.ts +3 -0
  94. package/dist/dataParser/extended/number.mjs +4 -5
  95. package/dist/dataParser/extended/object.cjs +19 -6
  96. package/dist/dataParser/extended/object.d.ts +5 -0
  97. package/dist/dataParser/extended/object.mjs +19 -6
  98. package/dist/dataParser/extended/optional.cjs +4 -5
  99. package/dist/dataParser/extended/optional.d.ts +3 -0
  100. package/dist/dataParser/extended/optional.mjs +4 -5
  101. package/dist/dataParser/extended/pipe.cjs +4 -5
  102. package/dist/dataParser/extended/pipe.d.ts +3 -0
  103. package/dist/dataParser/extended/pipe.mjs +4 -5
  104. package/dist/dataParser/extended/record.cjs +4 -5
  105. package/dist/dataParser/extended/record.d.ts +3 -0
  106. package/dist/dataParser/extended/record.mjs +4 -5
  107. package/dist/dataParser/extended/recover.cjs +4 -5
  108. package/dist/dataParser/extended/recover.d.ts +3 -0
  109. package/dist/dataParser/extended/recover.mjs +4 -5
  110. package/dist/dataParser/extended/string.cjs +4 -5
  111. package/dist/dataParser/extended/string.d.ts +3 -0
  112. package/dist/dataParser/extended/string.mjs +4 -5
  113. package/dist/dataParser/extended/templateLiteral.cjs +4 -5
  114. package/dist/dataParser/extended/templateLiteral.d.ts +3 -0
  115. package/dist/dataParser/extended/templateLiteral.mjs +4 -5
  116. package/dist/dataParser/extended/transform.cjs +4 -5
  117. package/dist/dataParser/extended/transform.d.ts +3 -0
  118. package/dist/dataParser/extended/transform.mjs +4 -5
  119. package/dist/dataParser/extended/tuple.cjs +6 -7
  120. package/dist/dataParser/extended/tuple.d.ts +3 -0
  121. package/dist/dataParser/extended/tuple.mjs +6 -7
  122. package/dist/dataParser/extended/union.cjs +4 -5
  123. package/dist/dataParser/extended/union.d.ts +3 -0
  124. package/dist/dataParser/extended/union.mjs +4 -5
  125. package/dist/dataParser/extended/unknown.cjs +4 -5
  126. package/dist/dataParser/extended/unknown.d.ts +3 -0
  127. package/dist/dataParser/extended/unknown.mjs +4 -5
  128. package/dist/dataParser/identifier.cjs +0 -2
  129. package/dist/dataParser/identifier.d.ts +52 -10
  130. package/dist/dataParser/identifier.mjs +0 -2
  131. package/dist/dataParser/index.cjs +72 -65
  132. package/dist/dataParser/index.mjs +21 -18
  133. package/dist/dataParser/kind.cjs +0 -2
  134. package/dist/dataParser/kind.mjs +0 -2
  135. package/dist/dataParser/parsers/array/index.cjs +4 -1
  136. package/dist/dataParser/parsers/array/index.d.ts +3 -0
  137. package/dist/dataParser/parsers/array/index.mjs +4 -1
  138. package/dist/dataParser/parsers/bigint/index.cjs +4 -1
  139. package/dist/dataParser/parsers/bigint/index.d.ts +3 -0
  140. package/dist/dataParser/parsers/bigint/index.mjs +4 -1
  141. package/dist/dataParser/parsers/boolean.cjs +4 -1
  142. package/dist/dataParser/parsers/boolean.d.ts +3 -0
  143. package/dist/dataParser/parsers/boolean.mjs +4 -1
  144. package/dist/dataParser/parsers/coerce/bigint.cjs +0 -4
  145. package/dist/dataParser/parsers/coerce/bigint.mjs +0 -4
  146. package/dist/dataParser/parsers/coerce/boolean.cjs +0 -4
  147. package/dist/dataParser/parsers/coerce/boolean.mjs +0 -4
  148. package/dist/dataParser/parsers/coerce/date.cjs +12 -0
  149. package/dist/dataParser/parsers/coerce/date.d.ts +6 -0
  150. package/dist/dataParser/parsers/coerce/date.mjs +10 -0
  151. package/dist/dataParser/parsers/coerce/empty.cjs +0 -4
  152. package/dist/dataParser/parsers/coerce/empty.mjs +0 -4
  153. package/dist/dataParser/parsers/coerce/index.cjs +2 -0
  154. package/dist/dataParser/parsers/coerce/index.d.ts +1 -0
  155. package/dist/dataParser/parsers/coerce/index.mjs +1 -0
  156. package/dist/dataParser/parsers/coerce/nil.cjs +0 -4
  157. package/dist/dataParser/parsers/coerce/nil.mjs +0 -4
  158. package/dist/dataParser/parsers/coerce/number.cjs +0 -4
  159. package/dist/dataParser/parsers/coerce/number.mjs +0 -4
  160. package/dist/dataParser/parsers/coerce/string.cjs +0 -4
  161. package/dist/dataParser/parsers/coerce/string.mjs +0 -4
  162. package/dist/dataParser/parsers/date.cjs +50 -0
  163. package/dist/dataParser/parsers/date.d.ts +28 -0
  164. package/dist/dataParser/parsers/date.mjs +47 -0
  165. package/dist/dataParser/parsers/empty.cjs +4 -1
  166. package/dist/dataParser/parsers/empty.d.ts +3 -0
  167. package/dist/dataParser/parsers/empty.mjs +4 -1
  168. package/dist/dataParser/parsers/index.d.ts +1 -0
  169. package/dist/dataParser/parsers/lazy.cjs +5 -4
  170. package/dist/dataParser/parsers/lazy.d.ts +3 -0
  171. package/dist/dataParser/parsers/lazy.mjs +5 -4
  172. package/dist/dataParser/parsers/literal.cjs +5 -4
  173. package/dist/dataParser/parsers/literal.d.ts +3 -0
  174. package/dist/dataParser/parsers/literal.mjs +5 -4
  175. package/dist/dataParser/parsers/nil.cjs +4 -1
  176. package/dist/dataParser/parsers/nil.d.ts +3 -0
  177. package/dist/dataParser/parsers/nil.mjs +4 -1
  178. package/dist/dataParser/parsers/nullable.cjs +4 -1
  179. package/dist/dataParser/parsers/nullable.d.ts +3 -0
  180. package/dist/dataParser/parsers/nullable.mjs +4 -1
  181. package/dist/dataParser/parsers/number/index.cjs +4 -1
  182. package/dist/dataParser/parsers/number/index.d.ts +3 -0
  183. package/dist/dataParser/parsers/number/index.mjs +4 -1
  184. package/dist/dataParser/parsers/{object.cjs → object/index.cjs} +13 -12
  185. package/dist/dataParser/parsers/{object.d.ts → object/index.d.ts} +16 -12
  186. package/dist/dataParser/parsers/{object.mjs → object/index.mjs} +13 -12
  187. package/dist/dataParser/parsers/object/omit.cjs +15 -0
  188. package/dist/dataParser/parsers/object/omit.d.ts +6 -0
  189. package/dist/dataParser/parsers/object/omit.mjs +13 -0
  190. package/dist/dataParser/parsers/object/pick.cjs +15 -0
  191. package/dist/dataParser/parsers/object/pick.d.ts +6 -0
  192. package/dist/dataParser/parsers/object/pick.mjs +13 -0
  193. package/dist/dataParser/parsers/optional.cjs +4 -1
  194. package/dist/dataParser/parsers/optional.d.ts +3 -0
  195. package/dist/dataParser/parsers/optional.mjs +4 -1
  196. package/dist/dataParser/parsers/pipe.cjs +4 -1
  197. package/dist/dataParser/parsers/pipe.d.ts +3 -0
  198. package/dist/dataParser/parsers/pipe.mjs +4 -1
  199. package/dist/dataParser/parsers/record/findRecordRequiredKey.cjs +17 -20
  200. package/dist/dataParser/parsers/record/findRecordRequiredKey.mjs +17 -20
  201. package/dist/dataParser/parsers/record/index.cjs +4 -1
  202. package/dist/dataParser/parsers/record/index.d.ts +3 -0
  203. package/dist/dataParser/parsers/record/index.mjs +4 -1
  204. package/dist/dataParser/parsers/recover.cjs +4 -1
  205. package/dist/dataParser/parsers/recover.d.ts +3 -0
  206. package/dist/dataParser/parsers/recover.mjs +4 -1
  207. package/dist/dataParser/parsers/string/index.cjs +4 -1
  208. package/dist/dataParser/parsers/string/index.d.ts +3 -0
  209. package/dist/dataParser/parsers/string/index.mjs +4 -1
  210. package/dist/dataParser/parsers/templateLiteral/createTemplateLiteralPattern.cjs +14 -17
  211. package/dist/dataParser/parsers/templateLiteral/createTemplateLiteralPattern.mjs +14 -17
  212. package/dist/dataParser/parsers/templateLiteral/index.cjs +5 -4
  213. package/dist/dataParser/parsers/templateLiteral/index.d.ts +3 -0
  214. package/dist/dataParser/parsers/templateLiteral/index.mjs +5 -4
  215. package/dist/dataParser/parsers/transform.cjs +4 -1
  216. package/dist/dataParser/parsers/transform.d.ts +3 -0
  217. package/dist/dataParser/parsers/transform.mjs +4 -1
  218. package/dist/dataParser/parsers/tuple.cjs +4 -1
  219. package/dist/dataParser/parsers/tuple.d.ts +3 -0
  220. package/dist/dataParser/parsers/tuple.mjs +4 -1
  221. package/dist/dataParser/parsers/union.cjs +4 -1
  222. package/dist/dataParser/parsers/union.d.ts +3 -0
  223. package/dist/dataParser/parsers/union.mjs +4 -1
  224. package/dist/dataParser/parsers/unknown.cjs +4 -1
  225. package/dist/dataParser/parsers/unknown.d.ts +3 -0
  226. package/dist/dataParser/parsers/unknown.mjs +4 -1
  227. package/dist/dataParser/types/dataParsers.d.ts +2 -2
  228. package/dist/date/closestTo.cjs +32 -0
  229. package/dist/date/closestTo.d.ts +7 -0
  230. package/dist/date/closestTo.mjs +30 -0
  231. package/dist/date/constants.cjs +29 -0
  232. package/dist/date/constants.d.ts +13 -0
  233. package/dist/date/constants.mjs +15 -0
  234. package/dist/date/create.cjs +50 -0
  235. package/dist/date/create.d.ts +16 -0
  236. package/dist/date/create.mjs +48 -0
  237. package/dist/date/createOrThrow.cjs +25 -0
  238. package/dist/date/createOrThrow.d.ts +10 -0
  239. package/dist/date/createOrThrow.mjs +22 -0
  240. package/dist/date/each.cjs +47 -0
  241. package/dist/date/each.d.ts +5 -0
  242. package/dist/date/each.mjs +45 -0
  243. package/dist/date/getters/getDayOfMonth.cjs +17 -0
  244. package/dist/date/getters/getDayOfMonth.d.ts +2 -0
  245. package/dist/date/getters/getDayOfMonth.mjs +15 -0
  246. package/dist/date/getters/getDayOfWeek.cjs +27 -0
  247. package/dist/date/getters/getDayOfWeek.d.ts +2 -0
  248. package/dist/date/getters/getDayOfWeek.mjs +25 -0
  249. package/dist/date/getters/getDayOfYear.cjs +34 -0
  250. package/dist/date/getters/getDayOfYear.d.ts +2 -0
  251. package/dist/date/getters/getDayOfYear.mjs +32 -0
  252. package/dist/date/getters/getFirstDayOfMonth.cjs +14 -0
  253. package/dist/date/getters/getFirstDayOfMonth.d.ts +2 -0
  254. package/dist/date/getters/getFirstDayOfMonth.mjs +12 -0
  255. package/dist/date/getters/getFirstDayOfWeek.cjs +16 -0
  256. package/dist/date/getters/getFirstDayOfWeek.d.ts +2 -0
  257. package/dist/date/getters/getFirstDayOfWeek.mjs +14 -0
  258. package/dist/date/getters/getHour.cjs +18 -0
  259. package/dist/date/getters/getHour.d.ts +2 -0
  260. package/dist/date/getters/getHour.mjs +16 -0
  261. package/dist/date/getters/getLastDayOfMonth.cjs +14 -0
  262. package/dist/date/getters/getLastDayOfMonth.d.ts +2 -0
  263. package/dist/date/getters/getLastDayOfMonth.mjs +12 -0
  264. package/dist/date/getters/getLastDayOfWeek.cjs +16 -0
  265. package/dist/date/getters/getLastDayOfWeek.d.ts +2 -0
  266. package/dist/date/getters/getLastDayOfWeek.mjs +14 -0
  267. package/dist/date/getters/getMilliseconds.cjs +10 -0
  268. package/dist/date/getters/getMilliseconds.d.ts +2 -0
  269. package/dist/date/getters/getMilliseconds.mjs +8 -0
  270. package/dist/date/getters/getMinute.cjs +17 -0
  271. package/dist/date/getters/getMinute.d.ts +2 -0
  272. package/dist/date/getters/getMinute.mjs +15 -0
  273. package/dist/date/getters/getMonth.cjs +17 -0
  274. package/dist/date/getters/getMonth.d.ts +2 -0
  275. package/dist/date/getters/getMonth.mjs +15 -0
  276. package/dist/date/getters/getSecond.cjs +17 -0
  277. package/dist/date/getters/getSecond.d.ts +2 -0
  278. package/dist/date/getters/getSecond.mjs +15 -0
  279. package/dist/date/getters/getWeekOfYear.cjs +37 -0
  280. package/dist/date/getters/getWeekOfYear.d.ts +2 -0
  281. package/dist/date/getters/getWeekOfYear.mjs +35 -0
  282. package/dist/date/getters/getYear.cjs +17 -0
  283. package/dist/date/getters/getYear.d.ts +2 -0
  284. package/dist/date/getters/getYear.mjs +15 -0
  285. package/dist/date/getters/index.d.ts +15 -0
  286. package/dist/date/index.cjs +121 -0
  287. package/dist/date/index.d.ts +18 -0
  288. package/dist/date/index.mjs +51 -0
  289. package/dist/date/isSafeTimestamp.cjs +15 -0
  290. package/dist/date/isSafeTimestamp.d.ts +1 -0
  291. package/dist/date/isSafeTimestamp.mjs +13 -0
  292. package/dist/date/now.cjs +8 -0
  293. package/dist/date/now.d.ts +1 -0
  294. package/dist/date/now.mjs +6 -0
  295. package/dist/date/operators/addDays.cjs +20 -0
  296. package/dist/date/operators/addDays.d.ts +4 -0
  297. package/dist/date/operators/addDays.mjs +18 -0
  298. package/dist/date/operators/addHours.cjs +20 -0
  299. package/dist/date/operators/addHours.d.ts +4 -0
  300. package/dist/date/operators/addHours.mjs +18 -0
  301. package/dist/date/operators/addMilliseconds.cjs +19 -0
  302. package/dist/date/operators/addMilliseconds.d.ts +4 -0
  303. package/dist/date/operators/addMilliseconds.mjs +17 -0
  304. package/dist/date/operators/addMinutes.cjs +20 -0
  305. package/dist/date/operators/addMinutes.d.ts +4 -0
  306. package/dist/date/operators/addMinutes.mjs +18 -0
  307. package/dist/date/operators/addMonths.cjs +19 -0
  308. package/dist/date/operators/addMonths.d.ts +4 -0
  309. package/dist/date/operators/addMonths.mjs +17 -0
  310. package/dist/date/operators/addSeconds.cjs +20 -0
  311. package/dist/date/operators/addSeconds.d.ts +4 -0
  312. package/dist/date/operators/addSeconds.mjs +18 -0
  313. package/dist/date/operators/addWeeks.cjs +20 -0
  314. package/dist/date/operators/addWeeks.d.ts +4 -0
  315. package/dist/date/operators/addWeeks.mjs +18 -0
  316. package/dist/date/operators/addYears.cjs +19 -0
  317. package/dist/date/operators/addYears.d.ts +4 -0
  318. package/dist/date/operators/addYears.mjs +17 -0
  319. package/dist/date/operators/between.cjs +17 -0
  320. package/dist/date/operators/between.d.ts +3 -0
  321. package/dist/date/operators/between.mjs +15 -0
  322. package/dist/date/operators/betweenThan.cjs +17 -0
  323. package/dist/date/operators/betweenThan.d.ts +3 -0
  324. package/dist/date/operators/betweenThan.mjs +15 -0
  325. package/dist/date/operators/greater.cjs +16 -0
  326. package/dist/date/operators/greater.d.ts +3 -0
  327. package/dist/date/operators/greater.mjs +14 -0
  328. package/dist/date/operators/greaterThan.cjs +16 -0
  329. package/dist/date/operators/greaterThan.d.ts +3 -0
  330. package/dist/date/operators/greaterThan.mjs +14 -0
  331. package/dist/date/operators/index.d.ts +22 -0
  332. package/dist/date/operators/less.cjs +16 -0
  333. package/dist/date/operators/less.d.ts +3 -0
  334. package/dist/date/operators/less.mjs +14 -0
  335. package/dist/date/operators/lessThan.cjs +16 -0
  336. package/dist/date/operators/lessThan.d.ts +3 -0
  337. package/dist/date/operators/lessThan.mjs +14 -0
  338. package/dist/date/operators/subtractDays.cjs +20 -0
  339. package/dist/date/operators/subtractDays.d.ts +4 -0
  340. package/dist/date/operators/subtractDays.mjs +18 -0
  341. package/dist/date/operators/subtractHours.cjs +20 -0
  342. package/dist/date/operators/subtractHours.d.ts +4 -0
  343. package/dist/date/operators/subtractHours.mjs +18 -0
  344. package/dist/date/operators/subtractMilliseconds.cjs +19 -0
  345. package/dist/date/operators/subtractMilliseconds.d.ts +4 -0
  346. package/dist/date/operators/subtractMilliseconds.mjs +17 -0
  347. package/dist/date/operators/subtractMinutes.cjs +20 -0
  348. package/dist/date/operators/subtractMinutes.d.ts +4 -0
  349. package/dist/date/operators/subtractMinutes.mjs +18 -0
  350. package/dist/date/operators/subtractMonths.cjs +19 -0
  351. package/dist/date/operators/subtractMonths.d.ts +4 -0
  352. package/dist/date/operators/subtractMonths.mjs +17 -0
  353. package/dist/date/operators/subtractSeconds.cjs +20 -0
  354. package/dist/date/operators/subtractSeconds.d.ts +4 -0
  355. package/dist/date/operators/subtractSeconds.mjs +18 -0
  356. package/dist/date/operators/subtractWeeks.cjs +20 -0
  357. package/dist/date/operators/subtractWeeks.d.ts +4 -0
  358. package/dist/date/operators/subtractWeeks.mjs +18 -0
  359. package/dist/date/operators/subtractYears.cjs +19 -0
  360. package/dist/date/operators/subtractYears.d.ts +4 -0
  361. package/dist/date/operators/subtractYears.mjs +17 -0
  362. package/dist/date/round.cjs +23 -0
  363. package/dist/date/round.d.ts +3 -0
  364. package/dist/date/round.mjs +21 -0
  365. package/dist/date/toISOString.cjs +10 -0
  366. package/dist/date/toISOString.d.ts +2 -0
  367. package/dist/date/toISOString.mjs +8 -0
  368. package/dist/date/toNative.cjs +10 -0
  369. package/dist/date/toNative.d.ts +2 -0
  370. package/dist/date/toNative.mjs +8 -0
  371. package/dist/date/toTimestamp.cjs +31 -0
  372. package/dist/date/toTimestamp.d.ts +10 -0
  373. package/dist/date/toTimestamp.mjs +28 -0
  374. package/dist/date/today.cjs +8 -0
  375. package/dist/date/today.d.ts +1 -0
  376. package/dist/date/today.mjs +6 -0
  377. package/dist/date/tomorrow.cjs +10 -0
  378. package/dist/date/tomorrow.d.ts +1 -0
  379. package/dist/date/tomorrow.mjs +8 -0
  380. package/dist/date/types/index.d.ts +6 -0
  381. package/dist/date/types/isLeapYear.d.ts +8 -0
  382. package/dist/date/types/month.d.ts +9 -0
  383. package/dist/date/types/theDate.d.ts +1 -0
  384. package/dist/date/types/time.d.ts +5 -0
  385. package/dist/date/types/timezone.cjs +606 -0
  386. package/dist/date/types/timezone.d.ts +604 -0
  387. package/dist/date/types/timezone.mjs +604 -0
  388. package/dist/date/types/unit.d.ts +1 -0
  389. package/dist/date/yesterday.cjs +10 -0
  390. package/dist/date/yesterday.d.ts +1 -0
  391. package/dist/date/yesterday.mjs +8 -0
  392. package/dist/either/bool/falsy.cjs +2 -4
  393. package/dist/either/bool/falsy.mjs +2 -4
  394. package/dist/either/bool/truthy.cjs +4 -6
  395. package/dist/either/bool/truthy.mjs +4 -6
  396. package/dist/either/future/create.cjs +0 -2
  397. package/dist/either/future/create.mjs +0 -2
  398. package/dist/either/future/error.cjs +2 -4
  399. package/dist/either/future/error.mjs +2 -4
  400. package/dist/either/future/success.cjs +0 -2
  401. package/dist/either/future/success.mjs +0 -2
  402. package/dist/either/index.cjs +7 -7
  403. package/dist/either/index.mjs +3 -3
  404. package/dist/either/kind.cjs +0 -2
  405. package/dist/either/kind.mjs +0 -2
  406. package/dist/either/left/when.cjs +1 -3
  407. package/dist/either/left/when.mjs +1 -3
  408. package/dist/either/nullable/empty.cjs +3 -5
  409. package/dist/either/nullable/empty.mjs +3 -5
  410. package/dist/either/nullable/filled.cjs +4 -6
  411. package/dist/either/nullable/filled.mjs +4 -6
  412. package/dist/either/nullish/empty.cjs +3 -5
  413. package/dist/either/nullish/empty.mjs +3 -5
  414. package/dist/either/nullish/filled.cjs +3 -5
  415. package/dist/either/nullish/filled.mjs +3 -5
  416. package/dist/either/optional/empty.cjs +0 -2
  417. package/dist/either/optional/empty.mjs +0 -2
  418. package/dist/either/optional/filled.cjs +4 -6
  419. package/dist/either/optional/filled.mjs +4 -6
  420. package/dist/either/right/asyncPipe.cjs +2 -4
  421. package/dist/either/right/asyncPipe.d.ts +5 -0
  422. package/dist/either/right/asyncPipe.mjs +2 -4
  423. package/dist/either/right/pipe.cjs +1 -3
  424. package/dist/either/right/pipe.d.ts +5 -0
  425. package/dist/either/right/pipe.mjs +1 -3
  426. package/dist/either/right/when.cjs +1 -3
  427. package/dist/either/right/when.mjs +1 -3
  428. package/dist/either/whenHasInformation.cjs +1 -3
  429. package/dist/either/whenHasInformation.mjs +1 -3
  430. package/dist/generator/asyncReduce.cjs +0 -2
  431. package/dist/generator/asyncReduce.mjs +0 -2
  432. package/dist/generator/reduce.cjs +0 -2
  433. package/dist/generator/reduce.mjs +0 -2
  434. package/dist/index.cjs +39 -30
  435. package/dist/index.d.ts +2 -0
  436. package/dist/index.mjs +36 -30
  437. package/dist/number/between.cjs +12 -0
  438. package/dist/number/between.d.ts +2 -0
  439. package/dist/number/between.mjs +10 -0
  440. package/dist/number/betweenThan.cjs +12 -0
  441. package/dist/number/betweenThan.d.ts +2 -0
  442. package/dist/number/betweenThan.mjs +10 -0
  443. package/dist/number/index.cjs +4 -0
  444. package/dist/number/index.d.ts +3 -0
  445. package/dist/number/index.mjs +2 -0
  446. package/dist/number/types/index.d.ts +1 -0
  447. package/dist/number/types/positiveNumber.d.ts +1 -0
  448. package/dist/object/deepDiscriminate.cjs +1 -3
  449. package/dist/object/deepDiscriminate.mjs +1 -3
  450. package/dist/object/discriminate.cjs +0 -2
  451. package/dist/object/discriminate.mjs +0 -2
  452. package/dist/object/entries.cjs +1 -3
  453. package/dist/object/entries.mjs +1 -3
  454. package/dist/object/entry.d.ts +2 -2
  455. package/dist/object/fromEntries.d.ts +5 -3
  456. package/dist/object/keys.cjs +1 -3
  457. package/dist/object/keys.mjs +1 -3
  458. package/dist/object/values.cjs +1 -3
  459. package/dist/object/values.mjs +1 -3
  460. package/dist/pattern/exhaustive.cjs +0 -2
  461. package/dist/pattern/exhaustive.mjs +0 -2
  462. package/dist/pattern/index.cjs +7 -4
  463. package/dist/pattern/index.mjs +3 -2
  464. package/dist/pattern/match/builder.cjs +56 -0
  465. package/dist/pattern/match/builder.d.ts +30 -0
  466. package/dist/pattern/match/builder.mjs +53 -0
  467. package/dist/pattern/match/index.cjs +28 -0
  468. package/dist/pattern/{match.d.ts → match/index.d.ts} +7 -4
  469. package/dist/pattern/match/index.mjs +25 -0
  470. package/dist/pattern/otherwise.cjs +1 -3
  471. package/dist/pattern/otherwise.mjs +1 -3
  472. package/dist/pattern/result.cjs +0 -2
  473. package/dist/pattern/result.mjs +0 -2
  474. package/dist/pattern/types/complexUnMatchedValue/array.d.ts +1 -1
  475. package/dist/string/index.cjs +12 -12
  476. package/dist/string/index.mjs +6 -6
  477. package/dist/string/replace.cjs +15 -0
  478. package/dist/string/replace.d.ts +10 -2
  479. package/dist/string/replace.mjs +15 -0
  480. package/package.json +7 -1
  481. package/dist/pattern/match.cjs +0 -18
  482. package/dist/pattern/match.mjs +0 -16
@@ -0,0 +1,21 @@
1
+ import { toNative } from './toNative.mjs';
2
+
3
+ const stepMapper = {
4
+ second: (date) => date.setUTCMilliseconds(0),
5
+ minute: (date) => date.setUTCSeconds(0, 0),
6
+ hour: (date) => date.setUTCMinutes(0, 0, 0),
7
+ day: (date) => date.setUTCHours(0, 0, 0, 0),
8
+ month: (date) => new Date(date.setUTCDate(1)).setUTCHours(0, 0, 0, 0),
9
+ year: (date) => {
10
+ date.setUTCMonth(0, 1);
11
+ return date.setUTCHours(0, 0, 0, 0);
12
+ },
13
+ };
14
+ function round(input, unit = "day") {
15
+ const date = toNative(input);
16
+ const timestamp = stepMapper[unit](date);
17
+ const isNegative = timestamp < 0;
18
+ return `date${Math.abs(timestamp)}${isNegative ? "-" : "+"}`;
19
+ }
20
+
21
+ export { round };
@@ -0,0 +1,10 @@
1
+ 'use strict';
2
+
3
+ var toNative = require('./toNative.cjs');
4
+
5
+ function toISOString(input) {
6
+ const date = toNative.toNative(input);
7
+ return date.toISOString();
8
+ }
9
+
10
+ exports.toISOString = toISOString;
@@ -0,0 +1,2 @@
1
+ import type { TheDate } from "./types";
2
+ export declare function toISOString<GenericInput extends TheDate>(input: GenericInput): string;
@@ -0,0 +1,8 @@
1
+ import { toNative } from './toNative.mjs';
2
+
3
+ function toISOString(input) {
4
+ const date = toNative(input);
5
+ return date.toISOString();
6
+ }
7
+
8
+ export { toISOString };
@@ -0,0 +1,10 @@
1
+ 'use strict';
2
+
3
+ var toTimestamp = require('./toTimestamp.cjs');
4
+
5
+ function toNative(input) {
6
+ const timestamp = toTimestamp.toTimestamp(input);
7
+ return new Date(timestamp);
8
+ }
9
+
10
+ exports.toNative = toNative;
@@ -0,0 +1,2 @@
1
+ import type { TheDate } from "./types";
2
+ export declare function toNative<GenericInput extends TheDate>(input: GenericInput): Date;
@@ -0,0 +1,8 @@
1
+ import { toTimestamp } from './toTimestamp.mjs';
2
+
3
+ function toNative(input) {
4
+ const timestamp = toTimestamp(input);
5
+ return new Date(timestamp);
6
+ }
7
+
8
+ export { toNative };
@@ -0,0 +1,31 @@
1
+ 'use strict';
2
+
3
+ var constants = require('./constants.cjs');
4
+ var isSafeTimestamp = require('./isSafeTimestamp.cjs');
5
+ var kind = require('../common/kind.cjs');
6
+ var errorKindNamespace = require('../common/errorKindNamespace.cjs');
7
+
8
+ class InvalidTheDateError extends kind.kindHeritage("invalid-the-Date-error", errorKindNamespace.createErrorKind("invalid-the-Date-error"), Error) {
9
+ theDate;
10
+ constructor(theDate) {
11
+ super({}, ["TheDate is invalid."]);
12
+ this.theDate = theDate;
13
+ }
14
+ }
15
+ function toTimestamp(input) {
16
+ const match = input.match(constants.theDateRegex);
17
+ if (!match) {
18
+ throw new InvalidTheDateError(input);
19
+ }
20
+ const { value, sign } = match.groups;
21
+ const timestamp = Number(sign === "-"
22
+ ? `-${value}`
23
+ : value);
24
+ if (!isSafeTimestamp.isSafeTimestamp(timestamp)) {
25
+ throw new InvalidTheDateError(input);
26
+ }
27
+ return timestamp;
28
+ }
29
+
30
+ exports.InvalidTheDateError = InvalidTheDateError;
31
+ exports.toTimestamp = toTimestamp;
@@ -0,0 +1,10 @@
1
+ import type { TheDate } from "./types";
2
+ declare const InvalidTheDateError_base: new (params: {
3
+ "@DuplojsUtilsError/invalid-the-Date-error"?: unknown;
4
+ }, parentParams: [message?: string | undefined, options?: ErrorOptions | undefined]) => Error & import("../common").Kind<import("../common").KindDefinition<"invalid-the-Date-error", unknown>, unknown> & import("../common").Kind<import("../common").KindDefinition<"@DuplojsUtilsError/invalid-the-Date-error", unknown>, unknown>;
5
+ export declare class InvalidTheDateError extends InvalidTheDateError_base {
6
+ theDate: TheDate;
7
+ constructor(theDate: TheDate);
8
+ }
9
+ export declare function toTimestamp<GenericInput extends TheDate>(input: GenericInput): number;
10
+ export {};
@@ -0,0 +1,28 @@
1
+ import { theDateRegex } from './constants.mjs';
2
+ import { isSafeTimestamp } from './isSafeTimestamp.mjs';
3
+ import { kindHeritage } from '../common/kind.mjs';
4
+ import { createErrorKind } from '../common/errorKindNamespace.mjs';
5
+
6
+ class InvalidTheDateError extends kindHeritage("invalid-the-Date-error", createErrorKind("invalid-the-Date-error"), Error) {
7
+ theDate;
8
+ constructor(theDate) {
9
+ super({}, ["TheDate is invalid."]);
10
+ this.theDate = theDate;
11
+ }
12
+ }
13
+ function toTimestamp(input) {
14
+ const match = input.match(theDateRegex);
15
+ if (!match) {
16
+ throw new InvalidTheDateError(input);
17
+ }
18
+ const { value, sign } = match.groups;
19
+ const timestamp = Number(sign === "-"
20
+ ? `-${value}`
21
+ : value);
22
+ if (!isSafeTimestamp(timestamp)) {
23
+ throw new InvalidTheDateError(input);
24
+ }
25
+ return timestamp;
26
+ }
27
+
28
+ export { InvalidTheDateError, toTimestamp };
@@ -0,0 +1,8 @@
1
+ 'use strict';
2
+
3
+ function today() {
4
+ const timestamp = new Date().setUTCHours(0, 0, 0, 0);
5
+ return `date${timestamp}+`;
6
+ }
7
+
8
+ exports.today = today;
@@ -0,0 +1 @@
1
+ export declare function today(): `date${number}+`;
@@ -0,0 +1,6 @@
1
+ function today() {
2
+ const timestamp = new Date().setUTCHours(0, 0, 0, 0);
3
+ return `date${timestamp}+`;
4
+ }
5
+
6
+ export { today };
@@ -0,0 +1,10 @@
1
+ 'use strict';
2
+
3
+ var constants = require('./constants.cjs');
4
+
5
+ function tomorrow() {
6
+ const timestamp = Date.now() + constants.millisecondsInOneDay;
7
+ return `date${timestamp}+`;
8
+ }
9
+
10
+ exports.tomorrow = tomorrow;
@@ -0,0 +1 @@
1
+ export declare function tomorrow(): `date${number}+`;
@@ -0,0 +1,8 @@
1
+ import { millisecondsInOneDay } from './constants.mjs';
2
+
3
+ function tomorrow() {
4
+ const timestamp = Date.now() + millisecondsInOneDay;
5
+ return `date${timestamp}+`;
6
+ }
7
+
8
+ export { tomorrow };
@@ -0,0 +1,6 @@
1
+ export * from "./theDate";
2
+ export * from "./isLeapYear";
3
+ export * from "./timezone";
4
+ export * from "./unit";
5
+ export * from "./month";
6
+ export * from "./time";
@@ -0,0 +1,8 @@
1
+ import { type Digit } from "../../string";
2
+ type TenEven = "" | "2" | "4" | "6" | "8";
3
+ type OddTen = "1" | "3" | "5" | "7" | "9";
4
+ type MultipleOf4 = `${TenEven}${"0" | "4" | "8"}` | `${OddTen}${"2" | "6"}`;
5
+ type MultipleOf100 = `${Exclude<Digit, "0">}00`;
6
+ type MultipleOf400 = `${Exclude<MultipleOf4, "0">}00`;
7
+ export type IsLeapYear<GenericYear extends `${number}`> = GenericYear extends `${number | ""}${MultipleOf4}` ? GenericYear extends `${number | ""}${MultipleOf100}` ? GenericYear extends `${number | ""}${MultipleOf400}` ? true : false : true : false;
8
+ export {};
@@ -0,0 +1,9 @@
1
+ import { type Digit } from "../../string";
2
+ export type Month = `0${Exclude<Digit, "0">}` | "10" | "11" | "12";
3
+ export type Day29 = Exclude<`${"0" | "1" | "2"}${Digit}`, "00">;
4
+ export type Day30 = Day29 | "30";
5
+ export type Day31 = Day30 | "31";
6
+ export type MonthWithDay29 = "02";
7
+ export type MonthWithDay30 = "04" | "06" | "09" | "11";
8
+ export type MonthWithDay31 = "01" | "03" | "05" | "07" | "08" | "10" | "12";
9
+ export type MonthWithDay = Month extends infer InferredMonth ? InferredMonth extends MonthWithDay29 ? `${InferredMonth}-${Day29}` : InferredMonth extends MonthWithDay30 ? `${InferredMonth}-${Day30}` : InferredMonth extends MonthWithDay31 ? `${InferredMonth}-${Day31}` : never : never;
@@ -0,0 +1 @@
1
+ export type TheDate = `date${number}${"-" | "+"}`;
@@ -0,0 +1,5 @@
1
+ import { type Digit } from "../../string";
2
+ export type Hour = `${"0" | "1"}${Digit}` | "20" | "21" | "22" | "23";
3
+ export type Minute = `${"0" | "1" | "2" | "3" | "4" | "5"}${Digit}`;
4
+ export type Second = `${"0" | "1" | "2" | "3" | "4" | "5"}${Digit}`;
5
+ export type Millisecond = `${Digit}${Digit}${Digit}`;