@pawells/typescript-common 2.0.0 → 2.1.5

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 (412) hide show
  1. package/README.md +350 -224
  2. package/{build → dist}/array/array-chunk.d.ts +1 -1
  3. package/{build → dist}/array/array-chunk.js +2 -3
  4. package/{build → dist}/array/array-compact.d.ts +1 -1
  5. package/{build → dist}/array/array-compact.js +1 -2
  6. package/{build → dist}/array/array-contains.d.ts +1 -1
  7. package/{build → dist}/array/array-contains.js +2 -3
  8. package/{build → dist}/array/array-count-by.d.ts +1 -1
  9. package/{build → dist}/array/array-count-by.js +2 -3
  10. package/{build → dist}/array/array-difference.d.ts +12 -5
  11. package/dist/array/array-difference.d.ts.map +1 -0
  12. package/dist/array/array-difference.js +70 -0
  13. package/dist/array/array-element.js +1 -0
  14. package/{build → dist}/array/array-filter.d.ts +1 -1
  15. package/{build → dist}/array/array-filter.js +1 -2
  16. package/{build → dist}/array/array-flatten.d.ts +2 -2
  17. package/{build → dist}/array/array-flatten.d.ts.map +1 -1
  18. package/{build → dist}/array/array-flatten.js +1 -2
  19. package/{build → dist}/array/array-group-by.d.ts +1 -1
  20. package/{build → dist}/array/array-group-by.d.ts.map +1 -1
  21. package/{build → dist}/array/array-group-by.js +10 -9
  22. package/{build → dist}/array/array-intersection.d.ts +12 -5
  23. package/dist/array/array-intersection.d.ts.map +1 -0
  24. package/dist/array/array-intersection.js +79 -0
  25. package/{build → dist}/array/array-partition.d.ts +1 -1
  26. package/{build → dist}/array/array-partition.js +2 -3
  27. package/{build → dist}/array/array-range.d.ts +1 -1
  28. package/{build → dist}/array/array-range.js +1 -2
  29. package/{build → dist}/array/array-sample.d.ts +2 -2
  30. package/{build → dist}/array/array-sample.js +3 -5
  31. package/{build → dist}/array/array-shuffle.d.ts +1 -1
  32. package/{build → dist}/array/array-shuffle.js +1 -2
  33. package/{build → dist}/array/array-sort-by.d.ts +1 -1
  34. package/{build → dist}/array/array-sort-by.js +1 -2
  35. package/{build → dist}/array/array-zip.d.ts +1 -1
  36. package/{build → dist}/array/array-zip.js +1 -2
  37. package/{build → dist}/array/assert.d.ts +5 -5
  38. package/{build → dist}/array/assert.d.ts.map +1 -1
  39. package/{build → dist}/array/assert.js +13 -14
  40. package/{build → dist}/array/index.js +0 -1
  41. package/{build → dist}/array/types.d.ts +20 -2
  42. package/{build → dist}/array/types.d.ts.map +1 -1
  43. package/dist/array/types.js +1 -0
  44. package/{build → dist}/array/unique.d.ts +1 -1
  45. package/{build → dist}/array/unique.js +1 -2
  46. package/dist/asserts/errors.d.ts.map +1 -0
  47. package/{build → dist}/asserts/errors.js +5 -3
  48. package/{build → dist}/asserts/generic.d.ts +23 -3
  49. package/dist/asserts/generic.d.ts.map +1 -0
  50. package/{build → dist}/asserts/generic.js +33 -7
  51. package/dist/asserts/index.d.ts +47 -0
  52. package/dist/asserts/index.d.ts.map +1 -0
  53. package/dist/asserts/index.js +46 -0
  54. package/{build → dist}/asserts/internal-utils.d.ts.map +1 -1
  55. package/{build → dist}/asserts/internal-utils.js +0 -1
  56. package/{build → dist}/asserts/types.d.ts +56 -17
  57. package/dist/asserts/types.d.ts.map +1 -0
  58. package/dist/asserts/types.js +1 -0
  59. package/{build → dist}/asserts/utils.d.ts +5 -21
  60. package/dist/asserts/utils.d.ts.map +1 -0
  61. package/{build → dist}/asserts/utils.js +12 -36
  62. package/{build → dist}/boolean/assert.d.ts +1 -2
  63. package/{build → dist}/boolean/assert.d.ts.map +1 -1
  64. package/{build → dist}/boolean/assert.js +1 -3
  65. package/dist/boolean/index.d.ts +13 -0
  66. package/dist/boolean/index.d.ts.map +1 -0
  67. package/dist/boolean/index.js +12 -0
  68. package/{build → dist}/enum/enum-entries.d.ts +1 -1
  69. package/dist/enum/enum-entries.d.ts.map +1 -0
  70. package/{build → dist}/enum/enum-entries.js +0 -1
  71. package/{build → dist}/enum/enum-key-by-value.d.ts +1 -1
  72. package/dist/enum/enum-key-by-value.d.ts.map +1 -0
  73. package/{build → dist}/enum/enum-key-by-value.js +0 -1
  74. package/{build → dist}/enum/enum-keys.js +0 -1
  75. package/{build → dist}/enum/enum-safe-value.d.ts +1 -1
  76. package/dist/enum/enum-safe-value.d.ts.map +1 -0
  77. package/{build → dist}/enum/enum-safe-value.js +0 -1
  78. package/{build → dist}/enum/enum-values.js +0 -1
  79. package/{build → dist}/enum/index.d.ts +1 -1
  80. package/dist/enum/index.d.ts.map +1 -0
  81. package/{build → dist}/enum/index.js +1 -2
  82. package/dist/enum/types.js +1 -0
  83. package/{build → dist}/enum/validate-enum-value.d.ts +1 -1
  84. package/dist/enum/validate-enum-value.d.ts.map +1 -0
  85. package/{build → dist}/enum/validate-enum-value.js +0 -1
  86. package/{build → dist}/function/compose.d.ts +6 -0
  87. package/dist/function/compose.d.ts.map +1 -0
  88. package/{build → dist}/function/compose.js +0 -1
  89. package/{build → dist}/function/debounce.d.ts +6 -0
  90. package/dist/function/debounce.d.ts.map +1 -0
  91. package/{build → dist}/function/debounce.js +6 -1
  92. package/{build → dist}/function/index.js +0 -1
  93. package/dist/function/memoize.d.ts +43 -0
  94. package/dist/function/memoize.d.ts.map +1 -0
  95. package/dist/function/memoize.js +59 -0
  96. package/{build → dist}/function/once.d.ts.map +1 -1
  97. package/{build → dist}/function/once.js +1 -1
  98. package/{build → dist}/function/sleep.js +0 -1
  99. package/{build → dist}/function/throttle.d.ts +7 -0
  100. package/dist/function/throttle.d.ts.map +1 -0
  101. package/{build → dist}/function/throttle.js +7 -1
  102. package/dist/function/types.d.ts +18 -0
  103. package/dist/function/types.d.ts.map +1 -0
  104. package/dist/function/types.js +1 -0
  105. package/dist/index.d.ts +11 -0
  106. package/dist/index.d.ts.map +1 -0
  107. package/dist/index.js +10 -0
  108. package/{build → dist}/lru-cache.d.ts +19 -0
  109. package/dist/lru-cache.d.ts.map +1 -0
  110. package/{build → dist}/lru-cache.js +24 -2
  111. package/{build → dist}/number/assert.js +0 -1
  112. package/dist/number/index.d.ts +13 -0
  113. package/dist/number/index.d.ts.map +1 -0
  114. package/dist/number/index.js +12 -0
  115. package/{build → dist}/object/assert-object.d.ts +5 -1
  116. package/{build → dist}/object/assert-object.d.ts.map +1 -1
  117. package/{build → dist}/object/assert-object.js +4 -1
  118. package/{build → dist}/object/assert.d.ts +1 -1
  119. package/dist/object/assert.d.ts.map +1 -0
  120. package/{build → dist}/object/assert.js +7 -29
  121. package/{build → dist}/object/clone.d.ts.map +1 -1
  122. package/{build → dist}/object/clone.js +8 -5
  123. package/{build → dist}/object/equals.d.ts.map +1 -1
  124. package/{build → dist}/object/equals.js +3 -7
  125. package/dist/object/filter-cached.d.ts +44 -0
  126. package/{build → dist}/object/filter-cached.d.ts.map +1 -1
  127. package/{build → dist}/object/filter-cached.js +41 -2
  128. package/{build → dist}/object/filter.d.ts.map +1 -1
  129. package/{build → dist}/object/filter.js +12 -5
  130. package/{build → dist}/object/has-circular-reference.d.ts.map +1 -1
  131. package/{build → dist}/object/has-circular-reference.js +4 -2
  132. package/{build → dist}/object/hash.d.ts +4 -0
  133. package/dist/object/hash.d.ts.map +1 -0
  134. package/{build → dist}/object/hash.js +20 -7
  135. package/{build → dist}/object/index.d.ts +2 -2
  136. package/{build → dist}/object/index.d.ts.map +1 -1
  137. package/{build → dist}/object/index.js +1 -2
  138. package/{build → dist}/object/json-circular-replacer.d.ts.map +1 -1
  139. package/{build → dist}/object/json-circular-replacer.js +0 -1
  140. package/{build → dist}/object/key-value-pairs.js +0 -1
  141. package/dist/object/map-cached.d.ts +31 -0
  142. package/dist/object/map-cached.d.ts.map +1 -0
  143. package/{build → dist}/object/map-cached.js +34 -6
  144. package/{build → dist}/object/map.js +0 -1
  145. package/{build → dist}/object/merge.d.ts.map +1 -1
  146. package/{build → dist}/object/merge.js +7 -7
  147. package/{build → dist}/object/object-diff.d.ts +2 -2
  148. package/{build → dist}/object/object-diff.d.ts.map +1 -1
  149. package/{build → dist}/object/object-diff.js +11 -5
  150. package/{build → dist}/object/object-flatten.d.ts +1 -1
  151. package/{build → dist}/object/object-flatten.d.ts.map +1 -1
  152. package/{build → dist}/object/object-flatten.js +6 -4
  153. package/{build → dist}/object/object-invert.js +0 -1
  154. package/{build → dist}/object/omit.js +0 -1
  155. package/{build → dist}/object/pick.js +0 -1
  156. package/{build → dist}/object/property-paths.js +6 -7
  157. package/dist/object/security-utils.d.ts +193 -0
  158. package/dist/object/security-utils.d.ts.map +1 -0
  159. package/dist/object/security-utils.js +297 -0
  160. package/{build → dist}/object/sort-keys.d.ts +1 -1
  161. package/{build → dist}/object/sort-keys.d.ts.map +1 -1
  162. package/{build → dist}/object/sort-keys.js +18 -11
  163. package/{build → dist}/object/types.d.ts +60 -19
  164. package/dist/object/types.d.ts.map +1 -0
  165. package/dist/object/types.js +1 -0
  166. package/{build → dist}/string/assert.d.ts +5 -0
  167. package/dist/string/assert.d.ts.map +1 -0
  168. package/{build → dist}/string/assert.js +11 -1
  169. package/{build → dist}/string/case-conversion.js +0 -1
  170. package/{build → dist}/string/comparison.d.ts.map +1 -1
  171. package/{build → dist}/string/comparison.js +3 -1
  172. package/{build → dist}/string/formatting.d.ts.map +1 -1
  173. package/{build → dist}/string/formatting.js +5 -3
  174. package/{build → dist}/string/index.js +0 -1
  175. package/{build → dist}/string/transformation.js +0 -1
  176. package/dist/string/types.d.ts +118 -0
  177. package/dist/string/types.d.ts.map +1 -0
  178. package/dist/string/types.js +1 -0
  179. package/{build → dist}/string/validation.js +0 -1
  180. package/dist/time/elapsed-time/constants.d.ts +36 -0
  181. package/{build → dist}/time/elapsed-time/constants.d.ts.map +1 -1
  182. package/{build → dist}/time/elapsed-time/constants.js +32 -3
  183. package/{build → dist}/time/elapsed-time/elapsed-time.d.ts +67 -15
  184. package/dist/time/elapsed-time/elapsed-time.d.ts.map +1 -0
  185. package/{build → dist}/time/elapsed-time/elapsed-time.js +172 -78
  186. package/dist/time/elapsed-time/types.d.ts +336 -0
  187. package/dist/time/elapsed-time/types.d.ts.map +1 -0
  188. package/dist/time/elapsed-time/types.js +1 -0
  189. package/{build → dist}/time/elapsed-time/utils.d.ts +1 -1
  190. package/dist/time/elapsed-time/utils.d.ts.map +1 -0
  191. package/{build → dist}/time/elapsed-time/utils.js +0 -1
  192. package/{build → dist}/time/index.d.ts +0 -2
  193. package/{build → dist}/time/index.d.ts.map +1 -1
  194. package/{build → dist}/time/index.js +0 -2
  195. package/{build → dist}/time/stopwatch/entry.d.ts +1 -1
  196. package/dist/time/stopwatch/entry.d.ts.map +1 -0
  197. package/{build → dist}/time/stopwatch/entry.js +0 -1
  198. package/{build → dist}/time/stopwatch/stopwatch.d.ts +9 -3
  199. package/dist/time/stopwatch/stopwatch.d.ts.map +1 -0
  200. package/{build → dist}/time/stopwatch/stopwatch.js +9 -4
  201. package/package.json +58 -81
  202. package/LICENSE +0 -21
  203. package/build/array/array-chunk.js.map +0 -1
  204. package/build/array/array-compact.js.map +0 -1
  205. package/build/array/array-contains.js.map +0 -1
  206. package/build/array/array-count-by.js.map +0 -1
  207. package/build/array/array-difference.d.ts.map +0 -1
  208. package/build/array/array-difference.js +0 -51
  209. package/build/array/array-difference.js.map +0 -1
  210. package/build/array/array-element.js +0 -2
  211. package/build/array/array-element.js.map +0 -1
  212. package/build/array/array-filter.js.map +0 -1
  213. package/build/array/array-flatten.js.map +0 -1
  214. package/build/array/array-group-by.js.map +0 -1
  215. package/build/array/array-intersection.d.ts.map +0 -1
  216. package/build/array/array-intersection.js +0 -57
  217. package/build/array/array-intersection.js.map +0 -1
  218. package/build/array/array-partition.js.map +0 -1
  219. package/build/array/array-range.js.map +0 -1
  220. package/build/array/array-sample.js.map +0 -1
  221. package/build/array/array-shuffle.js.map +0 -1
  222. package/build/array/array-sort-by.js.map +0 -1
  223. package/build/array/array-zip.js.map +0 -1
  224. package/build/array/assert.js.map +0 -1
  225. package/build/array/index.js.map +0 -1
  226. package/build/array/types.js +0 -2
  227. package/build/array/types.js.map +0 -1
  228. package/build/array/unique.js.map +0 -1
  229. package/build/asserts/errors.d.ts.map +0 -1
  230. package/build/asserts/errors.js.map +0 -1
  231. package/build/asserts/generic.d.ts.map +0 -1
  232. package/build/asserts/generic.js.map +0 -1
  233. package/build/asserts/index.d.ts +0 -41
  234. package/build/asserts/index.d.ts.map +0 -1
  235. package/build/asserts/index.js +0 -41
  236. package/build/asserts/index.js.map +0 -1
  237. package/build/asserts/internal-utils.js.map +0 -1
  238. package/build/asserts/types.d.ts.map +0 -1
  239. package/build/asserts/types.js +0 -2
  240. package/build/asserts/types.js.map +0 -1
  241. package/build/asserts/utils.d.ts.map +0 -1
  242. package/build/asserts/utils.js.map +0 -1
  243. package/build/boolean/assert.js.map +0 -1
  244. package/build/boolean/index.d.ts +0 -9
  245. package/build/boolean/index.d.ts.map +0 -1
  246. package/build/boolean/index.js +0 -9
  247. package/build/boolean/index.js.map +0 -1
  248. package/build/enum/enum-entries.d.ts.map +0 -1
  249. package/build/enum/enum-entries.js.map +0 -1
  250. package/build/enum/enum-key-by-value.d.ts.map +0 -1
  251. package/build/enum/enum-key-by-value.js.map +0 -1
  252. package/build/enum/enum-keys.js.map +0 -1
  253. package/build/enum/enum-safe-value.d.ts.map +0 -1
  254. package/build/enum/enum-safe-value.js.map +0 -1
  255. package/build/enum/enum-values.js.map +0 -1
  256. package/build/enum/index.d.ts.map +0 -1
  257. package/build/enum/index.js.map +0 -1
  258. package/build/enum/types.js +0 -2
  259. package/build/enum/types.js.map +0 -1
  260. package/build/enum/validate-enum-value.d.ts.map +0 -1
  261. package/build/enum/validate-enum-value.js.map +0 -1
  262. package/build/function/compose.d.ts.map +0 -1
  263. package/build/function/compose.js.map +0 -1
  264. package/build/function/debounce.d.ts.map +0 -1
  265. package/build/function/debounce.js.map +0 -1
  266. package/build/function/index.js.map +0 -1
  267. package/build/function/memoize.d.ts +0 -30
  268. package/build/function/memoize.d.ts.map +0 -1
  269. package/build/function/memoize.js +0 -44
  270. package/build/function/memoize.js.map +0 -1
  271. package/build/function/once.js.map +0 -1
  272. package/build/function/sleep.js.map +0 -1
  273. package/build/function/throttle.d.ts.map +0 -1
  274. package/build/function/throttle.js.map +0 -1
  275. package/build/function/types.d.ts +0 -5
  276. package/build/function/types.d.ts.map +0 -1
  277. package/build/function/types.js +0 -2
  278. package/build/function/types.js.map +0 -1
  279. package/build/index.d.ts +0 -38
  280. package/build/index.d.ts.map +0 -1
  281. package/build/index.js +0 -64
  282. package/build/index.js.map +0 -1
  283. package/build/lru-cache.d.ts.map +0 -1
  284. package/build/lru-cache.js.map +0 -1
  285. package/build/number/assert.js.map +0 -1
  286. package/build/number/index.d.ts +0 -9
  287. package/build/number/index.d.ts.map +0 -1
  288. package/build/number/index.js +0 -9
  289. package/build/number/index.js.map +0 -1
  290. package/build/object/assert-object.js.map +0 -1
  291. package/build/object/assert.d.ts.map +0 -1
  292. package/build/object/assert.js.map +0 -1
  293. package/build/object/clone.js.map +0 -1
  294. package/build/object/equals.js.map +0 -1
  295. package/build/object/filter-cached.d.ts +0 -21
  296. package/build/object/filter-cached.js.map +0 -1
  297. package/build/object/filter.js.map +0 -1
  298. package/build/object/has-circular-reference.js.map +0 -1
  299. package/build/object/hash.d.ts.map +0 -1
  300. package/build/object/hash.js.map +0 -1
  301. package/build/object/index.js.map +0 -1
  302. package/build/object/json-circular-replacer.js.map +0 -1
  303. package/build/object/key-value-pairs.js.map +0 -1
  304. package/build/object/map-cached.d.ts +0 -20
  305. package/build/object/map-cached.d.ts.map +0 -1
  306. package/build/object/map-cached.js.map +0 -1
  307. package/build/object/map.js.map +0 -1
  308. package/build/object/merge.js.map +0 -1
  309. package/build/object/object-diff.js.map +0 -1
  310. package/build/object/object-flatten.js.map +0 -1
  311. package/build/object/object-invert.js.map +0 -1
  312. package/build/object/omit.js.map +0 -1
  313. package/build/object/pick.js.map +0 -1
  314. package/build/object/property-paths.js.map +0 -1
  315. package/build/object/security-utils.d.ts +0 -59
  316. package/build/object/security-utils.d.ts.map +0 -1
  317. package/build/object/security-utils.js +0 -161
  318. package/build/object/security-utils.js.map +0 -1
  319. package/build/object/sort-keys.js.map +0 -1
  320. package/build/object/types.d.ts.map +0 -1
  321. package/build/object/types.js +0 -6
  322. package/build/object/types.js.map +0 -1
  323. package/build/string/assert.d.ts.map +0 -1
  324. package/build/string/assert.js.map +0 -1
  325. package/build/string/case-conversion.js.map +0 -1
  326. package/build/string/comparison.js.map +0 -1
  327. package/build/string/formatting.js.map +0 -1
  328. package/build/string/index.js.map +0 -1
  329. package/build/string/transformation.js.map +0 -1
  330. package/build/string/types.d.ts +0 -44
  331. package/build/string/types.d.ts.map +0 -1
  332. package/build/string/types.js +0 -2
  333. package/build/string/types.js.map +0 -1
  334. package/build/string/validation.js.map +0 -1
  335. package/build/time/elapsed-time/constants.d.ts +0 -10
  336. package/build/time/elapsed-time/constants.js.map +0 -1
  337. package/build/time/elapsed-time/elapsed-time.d.ts.map +0 -1
  338. package/build/time/elapsed-time/elapsed-time.js.map +0 -1
  339. package/build/time/elapsed-time/types.d.ts +0 -150
  340. package/build/time/elapsed-time/types.d.ts.map +0 -1
  341. package/build/time/elapsed-time/types.js +0 -2
  342. package/build/time/elapsed-time/types.js.map +0 -1
  343. package/build/time/elapsed-time/utils.d.ts.map +0 -1
  344. package/build/time/elapsed-time/utils.js.map +0 -1
  345. package/build/time/index.js.map +0 -1
  346. package/build/time/stopwatch/entry-types.d.ts +0 -13
  347. package/build/time/stopwatch/entry-types.d.ts.map +0 -1
  348. package/build/time/stopwatch/entry-types.js +0 -2
  349. package/build/time/stopwatch/entry-types.js.map +0 -1
  350. package/build/time/stopwatch/entry.d.ts.map +0 -1
  351. package/build/time/stopwatch/entry.js.map +0 -1
  352. package/build/time/stopwatch/stopwatch.d.ts.map +0 -1
  353. package/build/time/stopwatch/stopwatch.js.map +0 -1
  354. /package/{build → dist}/array/array-chunk.d.ts.map +0 -0
  355. /package/{build → dist}/array/array-compact.d.ts.map +0 -0
  356. /package/{build → dist}/array/array-contains.d.ts.map +0 -0
  357. /package/{build → dist}/array/array-count-by.d.ts.map +0 -0
  358. /package/{build → dist}/array/array-element.d.ts +0 -0
  359. /package/{build → dist}/array/array-element.d.ts.map +0 -0
  360. /package/{build → dist}/array/array-filter.d.ts.map +0 -0
  361. /package/{build → dist}/array/array-partition.d.ts.map +0 -0
  362. /package/{build → dist}/array/array-range.d.ts.map +0 -0
  363. /package/{build → dist}/array/array-sample.d.ts.map +0 -0
  364. /package/{build → dist}/array/array-shuffle.d.ts.map +0 -0
  365. /package/{build → dist}/array/array-sort-by.d.ts.map +0 -0
  366. /package/{build → dist}/array/array-zip.d.ts.map +0 -0
  367. /package/{build → dist}/array/index.d.ts +0 -0
  368. /package/{build → dist}/array/index.d.ts.map +0 -0
  369. /package/{build → dist}/array/unique.d.ts.map +0 -0
  370. /package/{build → dist}/asserts/errors.d.ts +0 -0
  371. /package/{build → dist}/asserts/internal-utils.d.ts +0 -0
  372. /package/{build → dist}/enum/enum-keys.d.ts +0 -0
  373. /package/{build → dist}/enum/enum-keys.d.ts.map +0 -0
  374. /package/{build → dist}/enum/enum-values.d.ts +0 -0
  375. /package/{build → dist}/enum/enum-values.d.ts.map +0 -0
  376. /package/{build → dist}/enum/types.d.ts +0 -0
  377. /package/{build → dist}/enum/types.d.ts.map +0 -0
  378. /package/{build → dist}/function/index.d.ts +0 -0
  379. /package/{build → dist}/function/index.d.ts.map +0 -0
  380. /package/{build → dist}/function/once.d.ts +0 -0
  381. /package/{build → dist}/function/sleep.d.ts +0 -0
  382. /package/{build → dist}/function/sleep.d.ts.map +0 -0
  383. /package/{build → dist}/number/assert.d.ts +0 -0
  384. /package/{build → dist}/number/assert.d.ts.map +0 -0
  385. /package/{build → dist}/object/clone.d.ts +0 -0
  386. /package/{build → dist}/object/equals.d.ts +0 -0
  387. /package/{build → dist}/object/filter.d.ts +0 -0
  388. /package/{build → dist}/object/has-circular-reference.d.ts +0 -0
  389. /package/{build → dist}/object/json-circular-replacer.d.ts +0 -0
  390. /package/{build → dist}/object/key-value-pairs.d.ts +0 -0
  391. /package/{build → dist}/object/key-value-pairs.d.ts.map +0 -0
  392. /package/{build → dist}/object/map.d.ts +0 -0
  393. /package/{build → dist}/object/map.d.ts.map +0 -0
  394. /package/{build → dist}/object/merge.d.ts +0 -0
  395. /package/{build → dist}/object/object-invert.d.ts +0 -0
  396. /package/{build → dist}/object/object-invert.d.ts.map +0 -0
  397. /package/{build → dist}/object/omit.d.ts +0 -0
  398. /package/{build → dist}/object/omit.d.ts.map +0 -0
  399. /package/{build → dist}/object/pick.d.ts +0 -0
  400. /package/{build → dist}/object/pick.d.ts.map +0 -0
  401. /package/{build → dist}/object/property-paths.d.ts +0 -0
  402. /package/{build → dist}/object/property-paths.d.ts.map +0 -0
  403. /package/{build → dist}/string/case-conversion.d.ts +0 -0
  404. /package/{build → dist}/string/case-conversion.d.ts.map +0 -0
  405. /package/{build → dist}/string/comparison.d.ts +0 -0
  406. /package/{build → dist}/string/formatting.d.ts +0 -0
  407. /package/{build → dist}/string/index.d.ts +0 -0
  408. /package/{build → dist}/string/index.d.ts.map +0 -0
  409. /package/{build → dist}/string/transformation.d.ts +0 -0
  410. /package/{build → dist}/string/transformation.d.ts.map +0 -0
  411. /package/{build → dist}/string/validation.d.ts +0 -0
  412. /package/{build → dist}/string/validation.d.ts.map +0 -0
@@ -7,44 +7,55 @@ const MINUTES_PER_HOUR = 60;
7
7
  const HOURS_PER_DAY = 24;
8
8
  const DAYS_PER_WEEK = 7;
9
9
  const PRECISION_DECIMAL_PLACES = 3;
10
+ // Format key aliases for case-insensitive matching
11
+ const FORMAT_ALIASES = {
12
+ mostsignificant: 'mostSignificant',
13
+ timewithseconds: 'timeWithSeconds',
14
+ };
10
15
  /**
11
16
  * Represents a duration of time with formatting and calculation capabilities.
12
17
  */
13
18
  export class ElapsedTime {
14
19
  /** Whether the elapsed time represents a negative duration */
15
- _IsNegative = false;
20
+ _isNegative = false;
16
21
  /** The total duration in milliseconds (always positive, sign stored in isNegative) */
17
- _TotalMilliseconds = 0;
22
+ _totalMilliseconds = 0;
18
23
  // Cached calculations for better performance - computed on-demand
19
24
  /** Cached total seconds value */
20
- _TotalSeconds = 0;
25
+ _totalSeconds = 0;
21
26
  /** Cached total minutes value */
22
- _TotalMinutes = 0;
27
+ _totalMinutes = 0;
23
28
  /** Cached total hours value */
24
- _TotalHours = 0;
29
+ _totalHours = 0;
25
30
  /** Cached total days value */
26
- _TotalDays = 0;
31
+ _totalDays = 0;
27
32
  /** Cached seconds component (excluding complete minutes) */
28
- _Seconds = 0;
33
+ _seconds = 0;
29
34
  /** Cached minutes component (excluding complete hours) */
30
- _Minutes = 0;
35
+ _minutes = 0;
31
36
  /** Cached hours component (excluding complete days) */
32
- _Hours = 0;
37
+ _hours = 0;
33
38
  /** Cached days component (excluding complete weeks) */
34
- _Days = 0;
39
+ _days = 0;
35
40
  /** Cached weeks component */
36
- _Weeks = 0;
41
+ _weeks = 0;
37
42
  /** Cached milliseconds component (excluding complete seconds) */
38
- _Milliseconds = 0;
43
+ _milliseconds = 0;
39
44
  /** Flag to track whether cached values have been calculated */
40
- _ValuesCalculated = false;
45
+ _valuesCalculated = false;
46
+ /**
47
+ * Cache object for computed property values when in stopped/paused state.
48
+ * Stores the last computed property value to avoid recalculation on repeated access.
49
+ * Cleared when TotalMilliseconds is set (instance becomes mutable again).
50
+ */
51
+ _propertyCache = {};
41
52
  /**
42
53
  * Creates a new ElapsedTime instance.
43
54
  * @param milliseconds The total number of milliseconds.
44
55
  */
45
56
  constructor(milliseconds) {
46
- this._TotalMilliseconds = Math.abs(milliseconds);
47
- this._IsNegative = milliseconds < 0;
57
+ this._totalMilliseconds = Math.abs(milliseconds);
58
+ this._isNegative = milliseconds < 0;
48
59
  }
49
60
  /**
50
61
  * Calculate all time unit values for efficient access.
@@ -68,47 +79,76 @@ export class ElapsedTime {
68
79
  * ```
69
80
  */
70
81
  _CalculateTimeValues() {
71
- if (this._ValuesCalculated)
82
+ if (this._valuesCalculated)
72
83
  return;
73
- this._TotalSeconds = Math.floor(this._TotalMilliseconds / MS_PER_SECOND);
74
- this._TotalMinutes = Math.floor(this._TotalSeconds / SECONDS_PER_MINUTE);
75
- this._TotalHours = Math.floor(this._TotalMinutes / MINUTES_PER_HOUR);
76
- this._TotalDays = Math.floor(this._TotalHours / HOURS_PER_DAY);
77
- this._Weeks = Math.floor(this._TotalDays / DAYS_PER_WEEK);
78
- this._Days = this._TotalDays % DAYS_PER_WEEK;
79
- this._Hours = this._TotalHours % HOURS_PER_DAY;
80
- this._Minutes = this._TotalMinutes % MINUTES_PER_HOUR;
81
- this._Seconds = this._TotalSeconds % SECONDS_PER_MINUTE;
82
- this._Milliseconds = this._TotalMilliseconds % MS_PER_SECOND;
83
- this._ValuesCalculated = true;
84
+ this._totalSeconds = Math.floor(this._totalMilliseconds / MS_PER_SECOND);
85
+ this._totalMinutes = Math.floor(this._totalSeconds / SECONDS_PER_MINUTE);
86
+ this._totalHours = Math.floor(this._totalMinutes / MINUTES_PER_HOUR);
87
+ this._totalDays = Math.floor(this._totalHours / HOURS_PER_DAY);
88
+ this._weeks = Math.floor(this._totalDays / DAYS_PER_WEEK);
89
+ this._days = this._totalDays % DAYS_PER_WEEK;
90
+ this._hours = this._totalHours % HOURS_PER_DAY;
91
+ this._minutes = this._totalMinutes % MINUTES_PER_HOUR;
92
+ this._seconds = this._totalSeconds % SECONDS_PER_MINUTE;
93
+ this._milliseconds = this._totalMilliseconds % MS_PER_SECOND;
94
+ this._valuesCalculated = true;
95
+ }
96
+ /**
97
+ * Get a cached property value, computing and caching it if necessary.
98
+ * For stopped/paused instances (where TotalMilliseconds doesn't change),
99
+ * this returns the cached value on subsequent accesses, avoiding repeated
100
+ * property getter indirection and computation.
101
+ *
102
+ * @param key - Cache key identifying the property
103
+ * @param getter - Function to compute the value if not cached
104
+ * @returns The cached or newly computed value
105
+ * @private
106
+ */
107
+ _getCachedProperty(key, getter) {
108
+ // Check if value is already cached
109
+ if (key in this._propertyCache) {
110
+ return this._propertyCache[key];
111
+ }
112
+ // Compute and cache the value
113
+ const value = getter();
114
+ this._propertyCache[key] = value;
115
+ return value;
84
116
  }
85
117
  /**
86
118
  * Gets the number of weeks in the elapsed time.
87
119
  */
88
120
  get Weeks() {
89
- this._CalculateTimeValues();
90
- return this._Weeks;
121
+ return this._getCachedProperty('weeks', () => {
122
+ this._CalculateTimeValues();
123
+ return this._weeks;
124
+ });
91
125
  }
92
126
  /**
93
127
  * Gets the number of days in the elapsed time (excluding complete weeks).
94
128
  */
95
129
  get Days() {
96
- this._CalculateTimeValues();
97
- return this._Days;
130
+ return this._getCachedProperty('days', () => {
131
+ this._CalculateTimeValues();
132
+ return this._days;
133
+ });
98
134
  }
99
135
  /**
100
136
  * Gets the total number of days in the elapsed time.
101
137
  */
102
138
  get TotalDays() {
103
- this._CalculateTimeValues();
104
- return this._TotalDays;
139
+ return this._getCachedProperty('totalDays', () => {
140
+ this._CalculateTimeValues();
141
+ return this._totalDays;
142
+ });
105
143
  }
106
144
  /**
107
145
  * Gets the number of hours in the elapsed time (excluding complete days).
108
146
  */
109
147
  get Hours() {
110
- this._CalculateTimeValues();
111
- return this._Hours;
148
+ return this._getCachedProperty('hours', () => {
149
+ this._CalculateTimeValues();
150
+ return this._hours;
151
+ });
112
152
  }
113
153
  static _pad(value, length) {
114
154
  return value.toString().padStart(length, '0');
@@ -125,8 +165,10 @@ export class ElapsedTime {
125
165
  * Gets the total number of hours in the elapsed time.
126
166
  */
127
167
  get TotalHours() {
128
- this._CalculateTimeValues();
129
- return this._TotalHours;
168
+ return this._getCachedProperty('totalHours', () => {
169
+ this._CalculateTimeValues();
170
+ return this._totalHours;
171
+ });
130
172
  }
131
173
  /**
132
174
  * Gets the total hours as a padded string.
@@ -140,8 +182,10 @@ export class ElapsedTime {
140
182
  * Gets the number of minutes in the elapsed time (excluding complete hours).
141
183
  */
142
184
  get Minutes() {
143
- this._CalculateTimeValues();
144
- return this._Minutes;
185
+ return this._getCachedProperty('minutes', () => {
186
+ this._CalculateTimeValues();
187
+ return this._minutes;
188
+ });
145
189
  }
146
190
  /**
147
191
  * Gets the minutes component as a padded string.
@@ -155,8 +199,10 @@ export class ElapsedTime {
155
199
  * Gets the total number of minutes in the elapsed time.
156
200
  */
157
201
  get TotalMinutes() {
158
- this._CalculateTimeValues();
159
- return this._TotalMinutes;
202
+ return this._getCachedProperty('totalMinutes', () => {
203
+ this._CalculateTimeValues();
204
+ return this._totalMinutes;
205
+ });
160
206
  }
161
207
  /**
162
208
  * Gets the total minutes as a padded string.
@@ -170,8 +216,10 @@ export class ElapsedTime {
170
216
  * Gets the number of seconds in the elapsed time (excluding complete minutes).
171
217
  */
172
218
  get Seconds() {
173
- this._CalculateTimeValues();
174
- return this._Seconds;
219
+ return this._getCachedProperty('seconds', () => {
220
+ this._CalculateTimeValues();
221
+ return this._seconds;
222
+ });
175
223
  }
176
224
  /**
177
225
  * Gets the seconds component as a padded string.
@@ -185,8 +233,10 @@ export class ElapsedTime {
185
233
  * Gets the total number of seconds in the elapsed time.
186
234
  */
187
235
  get TotalSeconds() {
188
- this._CalculateTimeValues();
189
- return this._TotalSeconds;
236
+ return this._getCachedProperty('totalSeconds', () => {
237
+ this._CalculateTimeValues();
238
+ return this._totalSeconds;
239
+ });
190
240
  }
191
241
  /**
192
242
  * Gets the total seconds as a padded string.
@@ -200,8 +250,10 @@ export class ElapsedTime {
200
250
  * Gets the number of milliseconds in the elapsed time (excluding complete seconds).
201
251
  */
202
252
  get Milliseconds() {
203
- this._CalculateTimeValues();
204
- return this._Milliseconds;
253
+ return this._getCachedProperty('milliseconds', () => {
254
+ this._CalculateTimeValues();
255
+ return this._milliseconds;
256
+ });
205
257
  }
206
258
  /**
207
259
  * Gets the milliseconds component as a padded string.
@@ -215,21 +267,22 @@ export class ElapsedTime {
215
267
  * Checks if the elapsed time represents a negative duration.
216
268
  */
217
269
  get IsNegative() {
218
- return this._IsNegative;
270
+ return this._isNegative;
219
271
  }
220
272
  /**
221
273
  * Gets the total number of milliseconds in the elapsed time.
222
274
  */
223
275
  get TotalMilliseconds() {
224
- return this._TotalMilliseconds;
276
+ return this._totalMilliseconds;
225
277
  }
226
278
  /**
227
279
  * Sets the total number of milliseconds in the elapsed time.
228
280
  */
229
281
  set TotalMilliseconds(value) {
230
- this._IsNegative = value < 0;
231
- this._TotalMilliseconds = Math.abs(value);
232
- this._ValuesCalculated = false;
282
+ this._isNegative = value < 0;
283
+ this._totalMilliseconds = Math.abs(value);
284
+ this._valuesCalculated = false;
285
+ this._propertyCache = {};
233
286
  }
234
287
  /**
235
288
  * Get the total milliseconds as a padded string.
@@ -367,10 +420,6 @@ export class ElapsedTime {
367
420
  this._CalculateTimeValues();
368
421
  let resolvedOptions = { ...options };
369
422
  // Handle predefined formats
370
- const FORMAT_ALIASES = {
371
- mostsignificant: 'mostSignificant',
372
- timewithseconds: 'timeWithSeconds',
373
- };
374
423
  let formatKey = '';
375
424
  if (typeof format === 'string') {
376
425
  const stripped = format.toLowerCase().replace(/_/g, '');
@@ -384,7 +433,7 @@ export class ElapsedTime {
384
433
  if (formatKey === 'long') {
385
434
  return this._FormatLong(appliedOptions);
386
435
  }
387
- return this._FormatUsingTokens(appliedOptions, formatKey);
436
+ return this._FormatUsingTokens(appliedOptions, formatKey, options);
388
437
  }
389
438
  /**
390
439
  * Special formatter for LONG format with proper pluralization.
@@ -408,23 +457,23 @@ export class ElapsedTime {
408
457
  _FormatLong(options) {
409
458
  const parts = [];
410
459
  // Process each time unit in order of significance
411
- if (this._Weeks > 0 || options.showZeroValues) {
412
- parts.push(`${this._Weeks} ${this._Weeks === 1 ? 'week' : 'weeks'}`);
460
+ if (this._weeks > 0 || options.showZeroValues) {
461
+ parts.push(`${this._weeks} ${this._weeks === 1 ? 'week' : 'weeks'}`);
413
462
  }
414
- if (this._Days > 0 || options.showZeroValues) {
415
- parts.push(`${this._Days} ${this._Days === 1 ? 'day' : 'days'}`);
463
+ if (this._days > 0 || options.showZeroValues) {
464
+ parts.push(`${this._days} ${this._days === 1 ? 'day' : 'days'}`);
416
465
  }
417
- if (this._Hours > 0 || options.showZeroValues) {
418
- parts.push(`${this._Hours} ${this._Hours === 1 ? 'hour' : 'hours'}`);
466
+ if (this._hours > 0 || options.showZeroValues) {
467
+ parts.push(`${this._hours} ${this._hours === 1 ? 'hour' : 'hours'}`);
419
468
  }
420
- if (this._Minutes > 0 || options.showZeroValues) {
421
- parts.push(`${this._Minutes} ${this._Minutes === 1 ? 'minute' : 'minutes'}`);
469
+ if (this._minutes > 0 || options.showZeroValues) {
470
+ parts.push(`${this._minutes} ${this._minutes === 1 ? 'minute' : 'minutes'}`);
422
471
  }
423
- if (this._Seconds > 0 || options.showZeroValues) {
424
- parts.push(`${this._Seconds} ${this._Seconds === 1 ? 'second' : 'seconds'}`);
472
+ if (this._seconds > 0 || options.showZeroValues) {
473
+ parts.push(`${this._seconds} ${this._seconds === 1 ? 'second' : 'seconds'}`);
425
474
  }
426
- if (this._Milliseconds > 0 || options.showZeroValues) {
427
- parts.push(`${this._Milliseconds} ${this._Milliseconds === 1 ? 'millisecond' : 'milliseconds'}`);
475
+ if (this._milliseconds > 0 || options.showZeroValues) {
476
+ parts.push(`${this._milliseconds} ${this._milliseconds === 1 ? 'millisecond' : 'milliseconds'}`);
428
477
  }
429
478
  // Handle case where no parts were added
430
479
  if (parts.length === 0) {
@@ -462,7 +511,7 @@ export class ElapsedTime {
462
511
  * // Called automatically by Format() method for most format types
463
512
  * ```
464
513
  */
465
- _FormatUsingTokens(options, formatKey = '') {
514
+ _FormatUsingTokens(options, formatKey = '', originalOptions = {}) {
466
515
  // Define all available time units
467
516
  const units = [
468
517
  { unit: 'week', value: this.Weeks },
@@ -475,6 +524,8 @@ export class ElapsedTime {
475
524
  // Filter and limit units based on options
476
525
  const filteredUnits = ElapsedTime._FilterAndLimitUnits(units, options);
477
526
  const unitLabels = options.unitLabels ?? DEFAULT_UNIT_LABELS.medium;
527
+ // Determine if custom labels were explicitly provided by the user (not from format defaults)
528
+ const hasCustomLabels = originalOptions.unitLabels !== undefined;
478
529
  // Determine the formatting approach based on the resolved format key.
479
530
  // TIME and TIME_WITH_SECONDS use a colon-separated layout; all other
480
531
  // predefined and custom formats use the standard token layout.
@@ -485,7 +536,7 @@ export class ElapsedTime {
485
536
  }
486
537
  else {
487
538
  // Handle different format types
488
- formatted = ElapsedTime._FormatStandardUnits(filteredUnits, unitLabels);
539
+ formatted = ElapsedTime._FormatStandardUnits(filteredUnits, unitLabels, formatKey, hasCustomLabels);
489
540
  }
490
541
  return this.IsNegative ? ElapsedTime._ApplyNegativeFormatting(formatted, options) : formatted;
491
542
  }
@@ -510,10 +561,12 @@ export class ElapsedTime {
510
561
  * Handles different formatting styles including CONCISE, SHORT, MEDIUM, LONG, and custom formats
511
562
  * @param units - Array of time units with their values
512
563
  * @param unitLabels - Object containing label definitions for each time unit
564
+ * @param formatKey - The format key (concise, short, medium, etc.)
565
+ * @param hasCustomLabels - Whether custom labels were provided by the user
513
566
  * @returns Formatted time string according to the specified format style
514
567
  * @private
515
568
  */
516
- static _FormatStandardUnits(units, unitLabels) {
569
+ static _FormatStandardUnits(units, unitLabels, formatKey = '', hasCustomLabels = false) {
517
570
  // Function-based labels: invoke each label function with the value (e.g. pluralization)
518
571
  if (Object.values(unitLabels).some((label) => typeof label === 'function')) {
519
572
  return units.map(({ unit, value }) => {
@@ -524,15 +577,25 @@ export class ElapsedTime {
524
577
  return `${value} ${label}`;
525
578
  }).join(' ');
526
579
  }
527
- // For CONCISE and SHORT formats (e.g., "1h 30m" or "1hr 30min")
528
- if (unitLabels === DEFAULT_UNIT_LABELS.concise || unitLabels === DEFAULT_UNIT_LABELS.short) {
580
+ // Detect the format style from the labels object or fall back to formatKey.
581
+ // This check is more robust than reference equality: it works even if a copy
582
+ // of the DEFAULT_UNIT_LABELS object is passed by external code.
583
+ const labelStyle = unitLabels.style;
584
+ const style = labelStyle || formatKey;
585
+ // Check if these are truly custom labels (not from DEFAULT_UNIT_LABELS or a copy thereof).
586
+ // If the labels have a recognized style property, treat them as default-style labels.
587
+ const isDefaultStyle = labelStyle !== undefined && ['concise', 'short', 'medium', 'long'].includes(labelStyle);
588
+ const hasActuallyCustomLabels = hasCustomLabels && !isDefaultStyle;
589
+ // For CONCISE and SHORT formats with default labels (no custom override)
590
+ // No space between value and label (e.g., "1h 30m" or "1hr 30min")
591
+ if (!hasActuallyCustomLabels && (style === 'concise' || style === 'short')) {
529
592
  return units.map(({ unit, value }) => `${value}${unitLabels[unit]}`).join(' ');
530
593
  }
531
594
  // For MEDIUM format (e.g., "1 hour 30 min")
532
- if (unitLabels === DEFAULT_UNIT_LABELS.medium) {
595
+ if (style === 'medium' || style === '') {
533
596
  return units.map(({ unit, value }) => `${value} ${unitLabels[unit]}`).join(' ');
534
597
  }
535
- // Custom labels: join with a space so units are properly separated.
598
+ // Custom labels or other formats: join with a space so units are properly separated.
536
599
  return units.map(({ unit, value }) => {
537
600
  const label = unitLabels[unit];
538
601
  if (typeof label === 'undefined')
@@ -612,7 +675,8 @@ export class ElapsedTime {
612
675
  }
613
676
  /**
614
677
  * Formats elapsed time using the specified configuration.
615
- * This is a simplified formatting function that uses IFormatConfig for basic formatting options.
678
+ * Convenience wrapper equivalent to `ElapsedTime.Format(milliseconds, 'concise', options)`.
679
+ * For other format styles, use {@link ElapsedTime.Format} directly.
616
680
  *
617
681
  * @param milliseconds - The total number of milliseconds to format
618
682
  * @param options - Formatting configuration options
@@ -625,6 +689,37 @@ export class ElapsedTime {
625
689
  * console.log(FormatElapsedTime(3661000)); // "1h 1m 1s"
626
690
  * console.log(FormatElapsedTime(3661000, { maxUnits: 1 })); // "1h"
627
691
  * ```
692
+ *
693
+ * @see ElapsedTime.Format
694
+ */
695
+ /**
696
+ * Format elapsed time using the concise format with optional customization.
697
+ * Convenience function that creates a temporary ElapsedTime instance and formats it.
698
+ * Always uses the 'concise' format (e.g., "1h 30m 45s") with optional overrides.
699
+ *
700
+ * @param milliseconds - The total number of milliseconds to format
701
+ * @param options - Optional formatting configuration to customize maxUnits and unitLabels
702
+ * @returns The formatted time string in concise format
703
+ *
704
+ * @example
705
+ * ```typescript
706
+ * // Basic usage with default concise format
707
+ * console.log(FormatElapsedTime(3661000)); // "1h 1m 1s"
708
+ * console.log(FormatElapsedTime(5425000)); // "1h 30m 25s"
709
+ *
710
+ * // With maxUnits option
711
+ * console.log(FormatElapsedTime(3661000, { maxUnits: 2 })); // "1h 1m"
712
+ *
713
+ * // With custom labels
714
+ * const options = {
715
+ * unitLabels: {
716
+ * hour: 'hrs',
717
+ * minute: 'mins',
718
+ * second: 'secs'
719
+ * }
720
+ * };
721
+ * console.log(FormatElapsedTime(3661000, options)); // "1 hrs 1 mins 1 secs"
722
+ * ```
628
723
  */
629
724
  export function FormatElapsedTime(milliseconds, options) {
630
725
  const elapsedTime = new ElapsedTime(milliseconds);
@@ -639,4 +734,3 @@ export function FormatElapsedTime(milliseconds, options) {
639
734
  }
640
735
  return elapsedTime.Format('concise', formatOptions);
641
736
  }
642
- //# sourceMappingURL=elapsed-time.js.map