@telperion/js-utils 3.7.1 → 3.8.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 (575) hide show
  1. package/.build-manifest.json +966 -0
  2. package/README.md +24 -0
  3. package/array/arrayize.cjs +5 -3
  4. package/array/arrayize.cjs.map +1 -0
  5. package/array/arrayize.d.cts +19 -0
  6. package/array/arrayize.d.ts +3 -1
  7. package/array/arrayize.js +2 -1
  8. package/array/arrayize.js.map +1 -1
  9. package/array/async-map.cjs +5 -3
  10. package/array/async-map.cjs.map +1 -0
  11. package/array/async-map.d.cts +36 -0
  12. package/array/async-map.d.ts +3 -1
  13. package/array/async-map.js +2 -1
  14. package/array/async-map.js.map +1 -1
  15. package/array/compact.cjs +8 -5
  16. package/array/compact.cjs.map +1 -0
  17. package/array/compact.d.cts +30 -0
  18. package/array/compact.d.ts +3 -1
  19. package/array/compact.js +4 -2
  20. package/array/compact.js.map +1 -1
  21. package/array/difference.cjs +5 -3
  22. package/array/difference.cjs.map +1 -0
  23. package/array/difference.d.cts +48 -0
  24. package/array/difference.d.ts +6 -3
  25. package/array/difference.js +2 -1
  26. package/array/difference.js.map +1 -1
  27. package/array/find-by-key.cjs +5 -3
  28. package/array/find-by-key.cjs.map +1 -0
  29. package/array/find-by-key.d.cts +32 -0
  30. package/array/find-by-key.d.ts +3 -1
  31. package/array/find-by-key.js +2 -1
  32. package/array/find-by-key.js.map +1 -1
  33. package/array/gather.cjs +5 -3
  34. package/array/gather.cjs.map +1 -0
  35. package/array/gather.d.cts +50 -0
  36. package/array/gather.d.ts +3 -1
  37. package/array/gather.js +2 -1
  38. package/array/gather.js.map +1 -1
  39. package/array/index.cjs +34 -15
  40. package/array/index.cjs.map +1 -0
  41. package/array/index.d.cts +14 -0
  42. package/array/index.d.ts +14 -12
  43. package/array/index.js +14 -13
  44. package/array/index.js.map +1 -1
  45. package/array/intersection.cjs +5 -3
  46. package/array/intersection.cjs.map +1 -0
  47. package/array/intersection.d.cts +48 -0
  48. package/array/intersection.d.ts +6 -3
  49. package/array/intersection.js +2 -1
  50. package/array/intersection.js.map +1 -1
  51. package/array/limit.cjs +5 -3
  52. package/array/limit.cjs.map +1 -0
  53. package/array/limit.d.cts +31 -0
  54. package/array/limit.d.ts +3 -1
  55. package/array/limit.js +2 -1
  56. package/array/limit.js.map +1 -1
  57. package/array/proto/async-map.cjs +6 -4
  58. package/array/proto/async-map.cjs.map +1 -0
  59. package/array/proto/async-map.d.cts +24 -0
  60. package/array/proto/async-map.d.ts +0 -1
  61. package/array/proto/async-map.js +2 -2
  62. package/array/proto/async-map.js.map +1 -1
  63. package/array/proto/compact.cjs +6 -4
  64. package/array/proto/compact.cjs.map +1 -0
  65. package/array/proto/compact.d.cts +14 -0
  66. package/array/proto/compact.d.ts +0 -1
  67. package/array/proto/compact.js +2 -2
  68. package/array/proto/compact.js.map +1 -1
  69. package/array/proto/difference.cjs +6 -4
  70. package/array/proto/difference.cjs.map +1 -0
  71. package/array/proto/difference.d.cts +28 -0
  72. package/array/proto/difference.d.ts +2 -1
  73. package/array/proto/difference.js +2 -2
  74. package/array/proto/difference.js.map +1 -1
  75. package/array/proto/find-by-key.cjs +6 -4
  76. package/array/proto/find-by-key.cjs.map +1 -0
  77. package/array/proto/find-by-key.d.cts +24 -0
  78. package/array/proto/find-by-key.d.ts +0 -1
  79. package/array/proto/find-by-key.js +2 -2
  80. package/array/proto/find-by-key.js.map +1 -1
  81. package/array/proto/gather.cjs +6 -4
  82. package/array/proto/gather.cjs.map +1 -0
  83. package/array/proto/gather.d.cts +31 -0
  84. package/array/proto/gather.d.ts +0 -1
  85. package/array/proto/gather.js +2 -2
  86. package/array/proto/gather.js.map +1 -1
  87. package/array/proto/intersection.cjs +6 -4
  88. package/array/proto/intersection.cjs.map +1 -0
  89. package/array/proto/intersection.d.cts +28 -0
  90. package/array/proto/intersection.d.ts +2 -1
  91. package/array/proto/intersection.js +2 -2
  92. package/array/proto/intersection.js.map +1 -1
  93. package/array/proto/limit.cjs +6 -4
  94. package/array/proto/limit.cjs.map +1 -0
  95. package/array/proto/limit.d.cts +23 -0
  96. package/array/proto/limit.d.ts +0 -1
  97. package/array/proto/limit.js +2 -2
  98. package/array/proto/limit.js.map +1 -1
  99. package/array/proto/remove.cjs +6 -4
  100. package/array/proto/remove.cjs.map +1 -0
  101. package/array/proto/remove.d.cts +32 -0
  102. package/array/proto/remove.d.ts +3 -3
  103. package/array/proto/remove.js +2 -2
  104. package/array/proto/remove.js.map +1 -1
  105. package/array/proto/replace.cjs +6 -4
  106. package/array/proto/replace.cjs.map +1 -0
  107. package/array/proto/replace.d.cts +73 -0
  108. package/array/proto/replace.d.ts +2 -1
  109. package/array/proto/replace.js +2 -2
  110. package/array/proto/replace.js.map +1 -1
  111. package/array/proto/slice-after.cjs +8 -0
  112. package/array/proto/slice-after.cjs.map +1 -0
  113. package/array/proto/slice-after.d.cts +33 -0
  114. package/array/proto/slice-after.d.ts +33 -0
  115. package/array/proto/slice-after.js +6 -0
  116. package/array/proto/slice-after.js.map +1 -0
  117. package/array/proto/slice-before.cjs +8 -0
  118. package/array/proto/slice-before.cjs.map +1 -0
  119. package/array/proto/slice-before.d.cts +33 -0
  120. package/array/proto/slice-before.d.ts +33 -0
  121. package/array/proto/slice-before.js +6 -0
  122. package/array/proto/slice-before.js.map +1 -0
  123. package/array/proto/uniquify-by-key.cjs +6 -4
  124. package/array/proto/uniquify-by-key.cjs.map +1 -0
  125. package/array/proto/uniquify-by-key.d.cts +23 -0
  126. package/array/proto/uniquify-by-key.d.ts +0 -1
  127. package/array/proto/uniquify-by-key.js +2 -2
  128. package/array/proto/uniquify-by-key.js.map +1 -1
  129. package/array/proto/uniquify.cjs +6 -4
  130. package/array/proto/uniquify.cjs.map +1 -0
  131. package/array/proto/uniquify.d.cts +22 -0
  132. package/array/proto/uniquify.d.ts +0 -1
  133. package/array/proto/uniquify.js +2 -2
  134. package/array/proto/uniquify.js.map +1 -1
  135. package/array/remove.cjs +5 -3
  136. package/array/remove.cjs.map +1 -0
  137. package/array/remove.d.cts +35 -0
  138. package/array/remove.d.ts +3 -1
  139. package/array/remove.js +2 -1
  140. package/array/remove.js.map +1 -1
  141. package/array/replace.cjs +5 -3
  142. package/array/replace.cjs.map +1 -0
  143. package/array/replace.d.cts +142 -0
  144. package/array/replace.d.ts +8 -5
  145. package/array/replace.js +2 -1
  146. package/array/replace.js.map +1 -1
  147. package/array/slice-after.cjs +44 -0
  148. package/array/slice-after.cjs.map +1 -0
  149. package/array/slice-after.d.cts +35 -0
  150. package/array/slice-after.d.ts +35 -0
  151. package/array/slice-after.js +42 -0
  152. package/array/slice-after.js.map +1 -0
  153. package/array/slice-before.cjs +44 -0
  154. package/array/slice-before.cjs.map +1 -0
  155. package/array/slice-before.d.cts +35 -0
  156. package/array/slice-before.d.ts +35 -0
  157. package/array/slice-before.js +42 -0
  158. package/array/slice-before.js.map +1 -0
  159. package/array/static/arrayize.cjs +6 -4
  160. package/array/static/arrayize.cjs.map +1 -0
  161. package/array/static/arrayize.d.cts +7 -0
  162. package/array/static/arrayize.d.ts +2 -1
  163. package/array/static/arrayize.js +2 -2
  164. package/array/static/arrayize.js.map +1 -1
  165. package/array/uniquify-by-key.cjs +5 -3
  166. package/array/uniquify-by-key.cjs.map +1 -0
  167. package/array/uniquify-by-key.d.cts +31 -0
  168. package/array/uniquify-by-key.d.ts +3 -1
  169. package/array/uniquify-by-key.js +2 -1
  170. package/array/uniquify-by-key.js.map +1 -1
  171. package/array/uniquify.cjs +5 -3
  172. package/array/uniquify.cjs.map +1 -0
  173. package/array/uniquify.d.cts +29 -0
  174. package/array/uniquify.d.ts +3 -1
  175. package/array/uniquify.js +2 -1
  176. package/array/uniquify.js.map +1 -1
  177. package/boolean/static/is-falsy.cjs +6 -4
  178. package/boolean/static/is-falsy.cjs.map +1 -0
  179. package/boolean/static/is-falsy.d.cts +24 -0
  180. package/boolean/static/is-falsy.d.ts +2 -1
  181. package/boolean/static/is-falsy.js +2 -2
  182. package/boolean/static/is-falsy.js.map +1 -1
  183. package/boolean/static/is-truthy.cjs +6 -4
  184. package/boolean/static/is-truthy.cjs.map +1 -0
  185. package/boolean/static/is-truthy.d.cts +24 -0
  186. package/boolean/static/is-truthy.d.ts +2 -1
  187. package/boolean/static/is-truthy.js +2 -2
  188. package/boolean/static/is-truthy.js.map +1 -1
  189. package/class/index.cjs +8 -4
  190. package/class/index.cjs.map +1 -0
  191. package/class/index.d.cts +1 -0
  192. package/class/index.d.ts +1 -1
  193. package/class/index.js +1 -2
  194. package/class/index.js.map +1 -1
  195. package/class/mixin.cjs +5 -3
  196. package/class/mixin.cjs.map +1 -0
  197. package/class/mixin.d.cts +51 -0
  198. package/class/mixin.d.ts +3 -2
  199. package/class/mixin.js +2 -1
  200. package/class/mixin.js.map +1 -1
  201. package/compact.cjs +10 -7
  202. package/compact.cjs.map +1 -0
  203. package/compact.d.cts +4 -0
  204. package/compact.d.ts +4 -2
  205. package/compact.js +7 -5
  206. package/compact.js.map +1 -1
  207. package/fesm/js-utils.mjs +1817 -0
  208. package/fesm/js-utils.mjs.map +1 -0
  209. package/function/call.cjs +5 -3
  210. package/function/call.cjs.map +1 -0
  211. package/function/call.d.cts +3 -0
  212. package/function/call.d.ts +3 -1
  213. package/function/call.js +2 -1
  214. package/function/call.js.map +1 -1
  215. package/function/debounce.cjs +19 -16
  216. package/function/debounce.cjs.map +1 -0
  217. package/function/debounce.d.cts +47 -0
  218. package/function/debounce.d.ts +7 -4
  219. package/function/debounce.js +8 -6
  220. package/function/debounce.js.map +1 -1
  221. package/function/defer.cjs +8 -5
  222. package/function/defer.cjs.map +1 -0
  223. package/function/defer.d.cts +28 -0
  224. package/function/defer.d.ts +3 -1
  225. package/function/defer.js +4 -2
  226. package/function/defer.js.map +1 -1
  227. package/function/index.cjs +18 -8
  228. package/function/index.cjs.map +1 -0
  229. package/function/index.d.cts +5 -0
  230. package/function/index.d.ts +5 -5
  231. package/function/index.js +5 -6
  232. package/function/index.js.map +1 -1
  233. package/function/noop.cjs +5 -3
  234. package/function/noop.cjs.map +1 -0
  235. package/function/noop.d.cts +22 -0
  236. package/function/noop.d.ts +3 -1
  237. package/function/noop.js +2 -1
  238. package/function/noop.js.map +1 -1
  239. package/function/of.cjs +8 -5
  240. package/function/of.cjs.map +1 -0
  241. package/function/of.d.cts +33 -0
  242. package/function/of.d.ts +3 -1
  243. package/function/of.js +4 -2
  244. package/function/of.js.map +1 -1
  245. package/function/proto/debounce.cjs +7 -5
  246. package/function/proto/debounce.cjs.map +1 -0
  247. package/function/proto/debounce.d.cts +29 -0
  248. package/function/proto/debounce.d.ts +0 -1
  249. package/function/proto/debounce.js +2 -2
  250. package/function/proto/debounce.js.map +1 -1
  251. package/function/static/call.cjs +6 -4
  252. package/function/static/call.cjs.map +1 -0
  253. package/function/static/call.d.cts +7 -0
  254. package/function/static/call.d.ts +2 -1
  255. package/function/static/call.js +2 -2
  256. package/function/static/call.js.map +1 -1
  257. package/function/static/defer.cjs +6 -4
  258. package/function/static/defer.cjs.map +1 -0
  259. package/function/static/defer.d.cts +24 -0
  260. package/function/static/defer.d.ts +2 -1
  261. package/function/static/defer.js +2 -2
  262. package/function/static/defer.js.map +1 -1
  263. package/function/static/noop.cjs +6 -4
  264. package/function/static/noop.cjs.map +1 -0
  265. package/function/static/noop.d.cts +19 -0
  266. package/function/static/noop.d.ts +2 -1
  267. package/function/static/noop.js +2 -2
  268. package/function/static/noop.js.map +1 -1
  269. package/function/static/of.cjs +6 -4
  270. package/function/static/of.cjs.map +1 -0
  271. package/function/static/of.d.cts +27 -0
  272. package/function/static/of.d.ts +2 -1
  273. package/function/static/of.js +2 -2
  274. package/function/static/of.js.map +1 -1
  275. package/index.cjs +95 -34
  276. package/index.cjs.map +1 -0
  277. package/index.d.cts +44 -0
  278. package/index.d.ts +44 -15
  279. package/index.js +43 -17
  280. package/index.js.map +1 -1
  281. package/is-falsy.cjs +5 -3
  282. package/is-falsy.cjs.map +1 -0
  283. package/is-falsy.d.cts +30 -0
  284. package/is-falsy.d.ts +3 -1
  285. package/is-falsy.js +2 -1
  286. package/is-falsy.js.map +1 -1
  287. package/is-truthy.cjs +5 -3
  288. package/is-truthy.cjs.map +1 -0
  289. package/is-truthy.d.cts +30 -0
  290. package/is-truthy.d.ts +3 -1
  291. package/is-truthy.js +2 -1
  292. package/is-truthy.js.map +1 -1
  293. package/limit.cjs +10 -7
  294. package/limit.cjs.map +1 -0
  295. package/limit.d.cts +4 -0
  296. package/limit.d.ts +4 -2
  297. package/limit.js +7 -5
  298. package/limit.js.map +1 -1
  299. package/map/index.cjs +8 -4
  300. package/map/index.cjs.map +1 -0
  301. package/map/index.d.cts +1 -0
  302. package/map/index.d.ts +1 -1
  303. package/map/index.js +1 -2
  304. package/map/index.js.map +1 -1
  305. package/map/merge.cjs +5 -3
  306. package/map/merge.cjs.map +1 -0
  307. package/map/merge.d.cts +26 -0
  308. package/map/merge.d.ts +3 -1
  309. package/map/merge.js +2 -1
  310. package/map/merge.js.map +1 -1
  311. package/math/index.cjs +8 -4
  312. package/math/index.cjs.map +1 -0
  313. package/math/index.d.cts +1 -0
  314. package/math/index.d.ts +1 -1
  315. package/math/index.js +1 -2
  316. package/math/index.js.map +1 -1
  317. package/math/min-max.cjs +5 -3
  318. package/math/min-max.cjs.map +1 -0
  319. package/math/min-max.d.cts +26 -0
  320. package/math/min-max.d.ts +3 -1
  321. package/math/min-max.js +2 -1
  322. package/math/min-max.js.map +1 -1
  323. package/math/static/min-max.cjs +6 -4
  324. package/math/static/min-max.cjs.map +1 -0
  325. package/math/static/min-max.d.cts +21 -0
  326. package/math/static/min-max.d.ts +2 -1
  327. package/math/static/min-max.js +2 -2
  328. package/math/static/min-max.js.map +1 -1
  329. package/object/clone.cjs +14 -11
  330. package/object/clone.cjs.map +1 -0
  331. package/object/clone.d.cts +164 -0
  332. package/object/clone.d.ts +9 -6
  333. package/object/clone.js +6 -4
  334. package/object/clone.js.map +1 -1
  335. package/object/compact.cjs +5 -3
  336. package/object/compact.cjs.map +1 -0
  337. package/object/compact.d.cts +39 -0
  338. package/object/compact.d.ts +3 -1
  339. package/object/compact.js +2 -1
  340. package/object/compact.js.map +1 -1
  341. package/object/deep-freeze.cjs +5 -3
  342. package/object/deep-freeze.cjs.map +1 -0
  343. package/object/deep-freeze.d.cts +3 -0
  344. package/object/deep-freeze.d.ts +3 -1
  345. package/object/deep-freeze.js +2 -1
  346. package/object/deep-freeze.js.map +1 -1
  347. package/object/deepest.cjs +5 -3
  348. package/object/deepest.cjs.map +1 -0
  349. package/object/deepest.d.cts +50 -0
  350. package/object/deepest.d.ts +5 -2
  351. package/object/deepest.js +2 -1
  352. package/object/deepest.js.map +1 -1
  353. package/object/index.cjs +16 -8
  354. package/object/index.cjs.map +1 -0
  355. package/object/index.d.cts +6 -0
  356. package/object/index.d.ts +6 -5
  357. package/object/index.js +5 -6
  358. package/object/index.js.map +1 -1
  359. package/object/map.cjs +5 -3
  360. package/object/map.cjs.map +1 -0
  361. package/object/map.d.cts +34 -0
  362. package/object/map.d.ts +3 -1
  363. package/object/map.js +2 -1
  364. package/object/map.js.map +1 -1
  365. package/object/static/clone.cjs +6 -4
  366. package/object/static/clone.cjs.map +1 -0
  367. package/object/static/clone.d.cts +44 -0
  368. package/object/static/clone.d.ts +2 -1
  369. package/object/static/clone.js +2 -2
  370. package/object/static/clone.js.map +1 -1
  371. package/object/static/compact.cjs +6 -4
  372. package/object/static/compact.cjs.map +1 -0
  373. package/object/static/compact.d.cts +27 -0
  374. package/object/static/compact.d.ts +2 -1
  375. package/object/static/compact.js +2 -2
  376. package/object/static/compact.js.map +1 -1
  377. package/object/static/deep-freeze.cjs +6 -4
  378. package/object/static/deep-freeze.cjs.map +1 -0
  379. package/object/static/deep-freeze.d.cts +7 -0
  380. package/object/static/deep-freeze.d.ts +2 -1
  381. package/object/static/deep-freeze.js +2 -2
  382. package/object/static/deep-freeze.js.map +1 -1
  383. package/object/static/deepest.cjs +6 -4
  384. package/object/static/deepest.cjs.map +1 -0
  385. package/object/static/deepest.d.cts +34 -0
  386. package/object/static/deepest.d.ts +3 -1
  387. package/object/static/deepest.js +2 -2
  388. package/object/static/deepest.js.map +1 -1
  389. package/object/static/map.cjs +6 -4
  390. package/object/static/map.cjs.map +1 -0
  391. package/object/static/map.d.cts +27 -0
  392. package/object/static/map.d.ts +2 -1
  393. package/object/static/map.js +2 -2
  394. package/object/static/map.js.map +1 -1
  395. package/open-promise.cjs +13 -11
  396. package/open-promise.cjs.map +1 -0
  397. package/open-promise.d.cts +82 -0
  398. package/open-promise.d.ts +5 -3
  399. package/open-promise.js +4 -2
  400. package/open-promise.js.map +1 -1
  401. package/package.json +817 -412
  402. package/promise/chain.cjs +5 -3
  403. package/promise/chain.cjs.map +1 -0
  404. package/promise/chain.d.cts +9 -0
  405. package/promise/chain.d.ts +3 -1
  406. package/promise/chain.js +2 -1
  407. package/promise/chain.js.map +1 -1
  408. package/promise/index.cjs +21 -10
  409. package/promise/index.cjs.map +1 -0
  410. package/promise/index.d.cts +7 -0
  411. package/promise/index.d.ts +7 -7
  412. package/promise/index.js +7 -8
  413. package/promise/index.js.map +1 -1
  414. package/promise/never.cjs +10 -7
  415. package/promise/never.cjs.map +1 -0
  416. package/promise/never.d.cts +36 -0
  417. package/promise/never.d.ts +4 -2
  418. package/promise/never.js +5 -3
  419. package/promise/never.js.map +1 -1
  420. package/promise/promisify.cjs +5 -3
  421. package/promise/promisify.cjs.map +1 -0
  422. package/promise/promisify.d.cts +9 -0
  423. package/promise/promisify.d.ts +3 -1
  424. package/promise/promisify.js +2 -1
  425. package/promise/promisify.js.map +1 -1
  426. package/promise/proto/revert.cjs +6 -4
  427. package/promise/proto/revert.cjs.map +1 -0
  428. package/promise/proto/revert.d.cts +28 -0
  429. package/promise/proto/revert.d.ts +0 -1
  430. package/promise/proto/revert.js +2 -2
  431. package/promise/proto/revert.js.map +1 -1
  432. package/promise/proto/try-catch.cjs +6 -4
  433. package/promise/proto/try-catch.cjs.map +1 -0
  434. package/promise/proto/try-catch.d.cts +29 -0
  435. package/promise/proto/try-catch.d.ts +0 -1
  436. package/promise/proto/try-catch.js +2 -2
  437. package/promise/proto/try-catch.js.map +1 -1
  438. package/promise/revert.cjs +5 -3
  439. package/promise/revert.cjs.map +1 -0
  440. package/promise/revert.d.cts +40 -0
  441. package/promise/revert.d.ts +3 -1
  442. package/promise/revert.js +2 -1
  443. package/promise/revert.js.map +1 -1
  444. package/promise/static/chain.cjs +6 -4
  445. package/promise/static/chain.cjs.map +1 -0
  446. package/promise/static/chain.d.cts +11 -0
  447. package/promise/static/chain.d.ts +2 -1
  448. package/promise/static/chain.js +2 -2
  449. package/promise/static/chain.js.map +1 -1
  450. package/promise/static/never.cjs +7 -5
  451. package/promise/static/never.cjs.map +1 -0
  452. package/promise/static/never.d.cts +40 -0
  453. package/promise/static/never.d.ts +2 -1
  454. package/promise/static/never.js +2 -2
  455. package/promise/static/never.js.map +1 -1
  456. package/promise/static/timeout.cjs +6 -4
  457. package/promise/static/timeout.cjs.map +1 -0
  458. package/promise/static/timeout.d.cts +22 -0
  459. package/promise/static/timeout.d.ts +2 -1
  460. package/promise/static/timeout.js +2 -2
  461. package/promise/static/timeout.js.map +1 -1
  462. package/promise/static/try-one-by-one.cjs +6 -4
  463. package/promise/static/try-one-by-one.cjs.map +1 -0
  464. package/promise/static/try-one-by-one.d.cts +28 -0
  465. package/promise/static/try-one-by-one.d.ts +2 -1
  466. package/promise/static/try-one-by-one.js +2 -2
  467. package/promise/static/try-one-by-one.js.map +1 -1
  468. package/promise/timeout.cjs +13 -11
  469. package/promise/timeout.cjs.map +1 -0
  470. package/promise/timeout.d.cts +112 -0
  471. package/promise/timeout.d.ts +5 -2
  472. package/promise/timeout.js +4 -3
  473. package/promise/timeout.js.map +1 -1
  474. package/promise/try-catch.cjs +5 -3
  475. package/promise/try-catch.cjs.map +1 -0
  476. package/promise/try-catch.d.cts +47 -0
  477. package/promise/try-catch.d.ts +4 -2
  478. package/promise/try-catch.js +2 -1
  479. package/promise/try-catch.js.map +1 -1
  480. package/promise/try-one-by-one.cjs +5 -3
  481. package/promise/try-one-by-one.cjs.map +1 -0
  482. package/promise/try-one-by-one.d.cts +44 -0
  483. package/promise/try-one-by-one.d.ts +3 -1
  484. package/promise/try-one-by-one.js +2 -1
  485. package/promise/try-one-by-one.js.map +1 -1
  486. package/set/proto/difference.cjs +6 -4
  487. package/set/proto/difference.cjs.map +1 -0
  488. package/set/proto/difference.d.cts +27 -0
  489. package/set/proto/difference.d.ts +2 -1
  490. package/set/proto/difference.js +2 -2
  491. package/set/proto/difference.js.map +1 -1
  492. package/set/proto/intersection.cjs +6 -4
  493. package/set/proto/intersection.cjs.map +1 -0
  494. package/set/proto/intersection.d.cts +27 -0
  495. package/set/proto/intersection.d.ts +2 -1
  496. package/set/proto/intersection.js +2 -2
  497. package/set/proto/intersection.js.map +1 -1
  498. package/smart-map.cjs +4 -3
  499. package/smart-map.cjs.map +1 -0
  500. package/smart-map.d.cts +82 -0
  501. package/smart-map.d.ts +3 -2
  502. package/smart-map.js +2 -1
  503. package/smart-map.js.map +1 -1
  504. package/string/index.cjs +8 -4
  505. package/string/index.cjs.map +1 -0
  506. package/string/index.d.cts +1 -0
  507. package/string/index.d.ts +1 -1
  508. package/string/index.js +1 -2
  509. package/string/index.js.map +1 -1
  510. package/string/limit.cjs +8 -5
  511. package/string/limit.cjs.map +1 -0
  512. package/string/limit.d.cts +31 -0
  513. package/string/limit.d.ts +3 -1
  514. package/string/limit.js +5 -3
  515. package/string/limit.js.map +1 -1
  516. package/string/proto/limit.cjs +6 -4
  517. package/string/proto/limit.cjs.map +1 -0
  518. package/string/proto/limit.d.cts +30 -0
  519. package/string/proto/limit.d.ts +3 -3
  520. package/string/proto/limit.js +2 -2
  521. package/string/proto/limit.js.map +1 -1
  522. package/time/days.cjs +8 -5
  523. package/time/days.cjs.map +1 -0
  524. package/time/days.d.cts +17 -0
  525. package/time/days.d.ts +3 -1
  526. package/time/days.js +4 -2
  527. package/time/days.js.map +1 -1
  528. package/time/hours.cjs +8 -5
  529. package/time/hours.cjs.map +1 -0
  530. package/time/hours.d.cts +17 -0
  531. package/time/hours.d.ts +3 -1
  532. package/time/hours.js +4 -2
  533. package/time/hours.js.map +1 -1
  534. package/time/index.cjs +20 -10
  535. package/time/index.cjs.map +1 -0
  536. package/time/index.d.cts +7 -0
  537. package/time/index.d.ts +7 -7
  538. package/time/index.js +7 -8
  539. package/time/index.js.map +1 -1
  540. package/time/minutes.cjs +8 -5
  541. package/time/minutes.cjs.map +1 -0
  542. package/time/minutes.d.cts +17 -0
  543. package/time/minutes.d.ts +3 -1
  544. package/time/minutes.js +4 -2
  545. package/time/minutes.js.map +1 -1
  546. package/time/months.cjs +8 -5
  547. package/time/months.cjs.map +1 -0
  548. package/time/months.d.cts +17 -0
  549. package/time/months.d.ts +3 -1
  550. package/time/months.js +4 -2
  551. package/time/months.js.map +1 -1
  552. package/time/seconds.cjs +5 -3
  553. package/time/seconds.cjs.map +1 -0
  554. package/time/seconds.d.cts +17 -0
  555. package/time/seconds.d.ts +3 -1
  556. package/time/seconds.js +2 -1
  557. package/time/seconds.js.map +1 -1
  558. package/time/weeks.cjs +8 -5
  559. package/time/weeks.cjs.map +1 -0
  560. package/time/weeks.d.cts +17 -0
  561. package/time/weeks.d.ts +3 -1
  562. package/time/weeks.js +4 -2
  563. package/time/weeks.js.map +1 -1
  564. package/time/years.cjs +8 -5
  565. package/time/years.cjs.map +1 -0
  566. package/time/years.d.cts +17 -0
  567. package/time/years.d.ts +3 -1
  568. package/time/years.js +4 -2
  569. package/time/years.js.map +1 -1
  570. package/unique-id.cjs +5 -3
  571. package/unique-id.cjs.map +1 -0
  572. package/unique-id.d.cts +23 -0
  573. package/unique-id.d.ts +4 -2
  574. package/unique-id.js +2 -1
  575. package/unique-id.js.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../libs/js-utils/src/promise/try-one-by-one.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAAI,QAAkE;IACpG,OAAO,MAAM,WAAW,CAAC,CAAC,GAAG,QAAQ,CAAC,EAAE,IAAI,CAAC,CAAC;AACjD,CAAC;AAED,KAAK,UAAU,WAAW,CAAI,QAAkE,EAAE,SAAkB;IAClH,MAAM,SAAS,GAAG,QAAQ,CAAC,KAAK,EAAE,CAAC;IAEnC,IAAI,CAAC,SAAS;QAAE,MAAM,SAAS,CAAC;IAEhC,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,OAAO,SAAS,KAAK,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QAEnF,OAAO,MAAM,OAAO,CAAC;IACvB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,WAAW,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;IACpC,CAAC;AACH,CAAC","file":"try-one-by-one.js","sourcesContent":["/**\n * #### Try One By One\n *\n * Tries a set of promises one by one with given order. Breaks the call when a promise resolved. Otherwise keeps trying incoming promises until the list is finished.\n *\n * * * *\n * Example:\n * ```typescript\n * import { tryOneByOne } from \"@telperion/js-utils/promise\";\n *\n * async function fooFunction() {\n * const foo = await tryOneByOne([\n * () => someCall(),\n * (err) => anotherCall(),\n * (err) => fooPromise()\n * ]);\n *\n * // do stuff\n * }\n *\n * ```\n *\n * Static Example:\n * ```typescript\n * import \"@telperion/js-utils/promise/static/try-one-by-one\";\n *\n * async function fooFunction() {\n * const foo = await Promise.tryOneByOne([\n * () => someCall(),\n * (err) => anotherCall(),\n * (err) => fooPromise()\n * ]);\n *\n * // do stuff\n * }\n *\n * ```\n * * * *\n * @param promises List of promises to try one by one with the order\n * @returns\n */\nexport async function tryOneByOne<T>(promises: Array<Promise<T> | ((lastError: unknown) => Promise<T>)>): Promise<T> {\n return await tryPromises([...promises], null);\n}\n\nasync function tryPromises<T>(promises: Array<Promise<T> | ((lastError: unknown) => Promise<T>)>, lastError: unknown): Promise<T> {\n const promiseFn = promises.shift();\n\n if (!promiseFn) throw lastError;\n\n try {\n const promise = typeof promiseFn === \"function\" ? promiseFn(lastError) : promiseFn;\n\n return await promise;\n } catch (err) {\n return tryPromises(promises, err);\n }\n}\n"]}
1
+ {"version":3,"file":"try-one-by-one.js","sources":["../../../../libs/js-utils/src/promise/try-one-by-one.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCG;AACI,eAAe,WAAW,CAAI,QAAkE,EAAA;IACpG,OAAO,MAAM,WAAW,CAAC,CAAC,GAAG,QAAQ,CAAC,EAAE,IAAI,CAAC;AAChD;AAEA,eAAe,WAAW,CAAI,QAAkE,EAAE,SAAkB,EAAA;AAClH,IAAA,MAAM,SAAS,GAAG,QAAQ,CAAC,KAAK,EAAE;AAElC,IAAA,IAAI,CAAC,SAAS;AAAE,QAAA,MAAM,SAAS;AAE/B,IAAA,IAAI;AACF,QAAA,MAAM,OAAO,GAAG,OAAO,SAAS,KAAK,UAAU,GAAG,SAAS,CAAC,SAAS,CAAC,GAAG,SAAS;QAElF,OAAO,MAAM,OAAO;IACtB;IAAE,OAAO,GAAG,EAAE;AACZ,QAAA,OAAO,WAAW,CAAC,QAAQ,EAAE,GAAG,CAAC;IACnC;AACF;;;;"}
@@ -1,6 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const difference_1 = require("@telperion/js-utils/array/difference");
1
+ 'use strict';
2
+
3
+ var array_difference = require('../../array/difference.cjs');
4
+
4
5
  Set.prototype.getDifference = function (substraction, allDiff = false) {
5
- return (0, difference_1.difference)(this, substraction, allDiff);
6
+ return array_difference.difference(this, substraction, allDiff);
6
7
  };
8
+ //# sourceMappingURL=difference.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"difference.cjs","sources":["../../../../../libs/js-utils/src/set/proto/difference.ts"],"sourcesContent":[null],"names":["difference"],"mappings":";;;;AA4BA,GAAG,CAAC,SAAS,CAAC,aAAa,GAAG,UAA0B,YAA0B,EAAE,OAAO,GAAG,KAAK,EAAA;IACjG,OAAOA,2BAAU,CAAC,IAAI,EAAE,YAAY,EAAE,OAAO,CAAC;AAChD,CAAC;;"}
@@ -0,0 +1,27 @@
1
+ import { Substraction } from '../../array/difference.cjs';
2
+
3
+ declare global {
4
+ export interface Set<T> {
5
+ /**
6
+ * #### Difference
7
+ *
8
+ * Gets the difference of the sets
9
+ *
10
+ * * * *
11
+ * Example:
12
+ * ```typescript
13
+ * import "@telperion/js-utils/set/proto/difference";
14
+ *
15
+ * const base = new Set(["a", "b", "c", "d"]);
16
+ *
17
+ * base.getDifference(["a", "b"]); // Set(["c", "d"])
18
+ * ```
19
+ * * * *
20
+ * @param base Base Set
21
+ * @param substraction Set or Array to remove its values from the base
22
+ * @param allDiff By default all the same items encountered in substraction will be removed, set this argument as true to get real difference
23
+ * @returns Difference of base from substraction
24
+ */
25
+ getDifference(substraction: Substraction, allDiff?: boolean): Set<T>;
26
+ }
27
+ }
@@ -1,4 +1,5 @@
1
- import { Substraction } from '@telperion/js-utils/array/difference';
1
+ import { Substraction } from '../../array/difference.js';
2
+
2
3
  declare global {
3
4
  export interface Set<T> {
4
5
  /**
@@ -1,6 +1,6 @@
1
- import { difference } from '@telperion/js-utils/array/difference';
1
+ import { difference } from '../../array/difference.js';
2
+
2
3
  Set.prototype.getDifference = function (substraction, allDiff = false) {
3
4
  return difference(this, substraction, allDiff);
4
5
  };
5
-
6
6
  //# sourceMappingURL=difference.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../libs/js-utils/src/set/proto/difference.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAgB,MAAM,sCAAsC,CAAC;AA4BhF,GAAG,CAAC,SAAS,CAAC,aAAa,GAAG,UAA0B,YAA0B,EAAE,OAAO,GAAG,KAAK;IACjG,OAAO,UAAU,CAAC,IAAI,EAAE,YAAY,EAAE,OAAO,CAAC,CAAC;AACjD,CAAC,CAAC","file":"difference.js","sourcesContent":["import { difference, Substraction } from '@telperion/js-utils/array/difference';\n\ndeclare global {\n export interface Set<T> {\n /**\n * #### Difference\n *\n * Gets the difference of the sets\n *\n * * * *\n * Example:\n * ```typescript\n * import \"@telperion/js-utils/set/proto/difference\";\n *\n * const base = new Set([\"a\", \"b\", \"c\", \"d\"]);\n *\n * base.getDifference([\"a\", \"b\"]); // Set([\"c\", \"d\"])\n * ```\n * * * *\n * @param base Base Set\n * @param substraction Set or Array to remove its values from the base\n * @param allDiff By default all the same items encountered in substraction will be removed, set this argument as true to get real difference\n * @returns Difference of base from substraction\n */\n getDifference(substraction: Substraction, allDiff?: boolean): Set<T>;\n }\n}\n\nSet.prototype.getDifference = function<T>(this: Set<T>, substraction: Substraction, allDiff = false) {\n return difference(this, substraction, allDiff);\n};\n"]}
1
+ {"version":3,"file":"difference.js","sources":["../../../../../libs/js-utils/src/set/proto/difference.ts"],"sourcesContent":[null],"names":[],"mappings":";;AA4BA,GAAG,CAAC,SAAS,CAAC,aAAa,GAAG,UAA0B,YAA0B,EAAE,OAAO,GAAG,KAAK,EAAA;IACjG,OAAO,UAAU,CAAC,IAAI,EAAE,YAAY,EAAE,OAAO,CAAC;AAChD,CAAC"}
@@ -1,6 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const intersection_1 = require("@telperion/js-utils/array/intersection");
1
+ 'use strict';
2
+
3
+ var array_intersection = require('../../array/intersection.cjs');
4
+
4
5
  Set.prototype.getIntersection = function (inclusion, allEquals = true) {
5
- return (0, intersection_1.intersection)(this, inclusion, allEquals);
6
+ return array_intersection.intersection(this, inclusion, allEquals);
6
7
  };
8
+ //# sourceMappingURL=intersection.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"intersection.cjs","sources":["../../../../../libs/js-utils/src/set/proto/intersection.ts"],"sourcesContent":[null],"names":["intersection"],"mappings":";;;;AA4BA,GAAG,CAAC,SAAS,CAAC,eAAe,GAAG,UAA0B,SAAoB,EAAE,SAAS,GAAG,IAAI,EAAA;IAC9F,OAAOA,+BAAY,CAAC,IAAI,EAAE,SAAS,EAAE,SAAS,CAAC;AACjD,CAAC;;"}
@@ -0,0 +1,27 @@
1
+ import { Inclusion } from '../../array/intersection.cjs';
2
+
3
+ declare global {
4
+ export interface Set<T> {
5
+ /**
6
+ * #### Intersection
7
+ *
8
+ * Gets the intersection of the two arrays or sets
9
+ *
10
+ * * * *
11
+ * Example:
12
+ * ```typescript
13
+ * import "@telperion/js-utils/set/proto/intersection";
14
+ *
15
+ * const base = new Set(["a", "b", "c", "d"]);
16
+ *
17
+ * base.getIntersection(["a", "b"]); // Set(["a", "b"])
18
+ * ```
19
+ * * * *
20
+ * @param base Base Set
21
+ * @param inclusion Set or Array to include its values
22
+ * @param allEquals By default all the same items encountered in the inclusion will be included, set this argument as false to get real intersection
23
+ * @returns Intersection of base and inclusion
24
+ */
25
+ getIntersection(inclusion: Inclusion, allEquals?: boolean): Set<T>;
26
+ }
27
+ }
@@ -1,4 +1,5 @@
1
- import { Inclusion } from '@telperion/js-utils/array/intersection';
1
+ import { Inclusion } from '../../array/intersection.js';
2
+
2
3
  declare global {
3
4
  export interface Set<T> {
4
5
  /**
@@ -1,6 +1,6 @@
1
- import { intersection } from '@telperion/js-utils/array/intersection';
1
+ import { intersection } from '../../array/intersection.js';
2
+
2
3
  Set.prototype.getIntersection = function (inclusion, allEquals = true) {
3
4
  return intersection(this, inclusion, allEquals);
4
5
  };
5
-
6
6
  //# sourceMappingURL=intersection.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../libs/js-utils/src/set/proto/intersection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAa,MAAM,wCAAwC,CAAC;AA4BjF,GAAG,CAAC,SAAS,CAAC,eAAe,GAAG,UAA0B,SAAoB,EAAE,SAAS,GAAG,IAAI;IAC9F,OAAO,YAAY,CAAC,IAAI,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;AAClD,CAAC,CAAC","file":"intersection.js","sourcesContent":["import { intersection, Inclusion } from '@telperion/js-utils/array/intersection';\n\ndeclare global {\n export interface Set<T> {\n /**\n * #### Intersection\n *\n * Gets the intersection of the two arrays or sets\n *\n * * * *\n * Example:\n * ```typescript\n * import \"@telperion/js-utils/set/proto/intersection\";\n *\n * const base = new Set([\"a\", \"b\", \"c\", \"d\"]);\n *\n * base.getIntersection([\"a\", \"b\"]); // Set([\"a\", \"b\"])\n * ```\n * * * *\n * @param base Base Set\n * @param inclusion Set or Array to include its values\n * @param allEquals By default all the same items encountered in the inclusion will be included, set this argument as false to get real intersection\n * @returns Intersection of base and inclusion\n */\n getIntersection(inclusion: Inclusion, allEquals?: boolean): Set<T>;\n }\n}\n\nSet.prototype.getIntersection = function<T>(this: Set<T>, inclusion: Inclusion, allEquals = true) {\n return intersection(this, inclusion, allEquals);\n};\n"]}
1
+ {"version":3,"file":"intersection.js","sources":["../../../../../libs/js-utils/src/set/proto/intersection.ts"],"sourcesContent":[null],"names":[],"mappings":";;AA4BA,GAAG,CAAC,SAAS,CAAC,eAAe,GAAG,UAA0B,SAAoB,EAAE,SAAS,GAAG,IAAI,EAAA;IAC9F,OAAO,YAAY,CAAC,IAAI,EAAE,SAAS,EAAE,SAAS,CAAC;AACjD,CAAC"}
package/smart-map.cjs CHANGED
@@ -1,7 +1,6 @@
1
- "use strict";
1
+ 'use strict';
2
+
2
3
  /* eslint-disable @typescript-eslint/no-explicit-any */
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.SmartMap = void 0;
5
4
  // Symbols to protect overriding private methods & properties of SmartMap Class
6
5
  const KEY__WEAKMAP = Symbol('SmartMap.weakMap');
7
6
  /**
@@ -105,4 +104,6 @@ class SmartMap extends Map {
105
104
  return this[KEY__WEAKMAP].delete(key) || super.delete(key);
106
105
  }
107
106
  }
107
+
108
108
  exports.SmartMap = SmartMap;
109
+ //# sourceMappingURL=smart-map.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"smart-map.cjs","sources":["../../../libs/js-utils/src/smart-map.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA;AAEA;AACA,MAAM,YAAY,GAAkB,MAAM,CAAC,kBAAkB,CAAC;AAE9D;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BG;AACG,MAAO,QAA2B,SAAQ,GAAS,CAAA;AACvD;;AAEG;AACO,IAAA,OAAgB,YAAY,GAAG,YAAY;AAErD;;AAEG;AACI,IAAA,OAAgB,yBAAyB,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;AAExF;;;;;AAKG;IACO,OAAO,mBAAmB,CAAM,GAAQ,EAAA;AAChD,QAAA,OAAO,GAAG,KAAK,IAAI,IAAI,QAAQ,CAAC,yBAAyB,CAAC,IAAI,CAAC,IAAI,IAAI,OAAO,GAAG,KAAK,IAAI,CAAC;IAC7F;AAEA;;AAEG;AACO,IAAA,CAAC,YAAY,IAAI,IAAI,OAAO,EAAqB;AAE3D;;;;;AAKG;AACM,IAAA,GAAG,CAAC,GAAM,EAAA;AACjB,QAAA,IAAI,QAAQ,CAAC,mBAAmB,CAAC,GAAG,CAAC,EAAE;YACrC,OAAO,IAAI,CAAC,YAAY,CAAC,CAAC,GAAG,CAAC,GAAI,CAAC;QACrC;AAEA,QAAA,OAAO,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC;IACvB;AAEA;;;;;AAKG;AACM,IAAA,GAAG,CAAC,GAAM,EAAA;AACjB,QAAA,IAAI,QAAQ,CAAC,mBAAmB,CAAC,GAAG,CAAC,EAAE;YACrC,OAAO,IAAI,CAAC,YAAY,CAAC,CAAC,GAAG,CAAC,GAAqB,CAAC;QACtD;AAEA,QAAA,OAAO,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC;IACvB;AAEA;;;;;;AAMG;IACM,GAAG,CAAC,GAAM,EAAE,KAAQ,EAAA;AAC3B,QAAA,IAAI,QAAQ,CAAC,mBAAmB,CAAC,GAAG,CAAC,EAAE;YACrC,IAAI,CAAC,YAAY,CAAC,CAAC,GAAG,CAAC,GAAqB,EAAE,KAAK,CAAC;QACtD;aAAO;AACL,YAAA,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC;QACvB;AAEA,QAAA,OAAO,IAAI;IACb;AAEA;;;;;AAKG;AACM,IAAA,MAAM,CAAC,GAAM,EAAA;AACpB,QAAA,OAAO,IAAI,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,GAAqB,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC;IAC9E;;;;;"}
@@ -0,0 +1,82 @@
1
+ declare const KEY__WEAKMAP: unique symbol;
2
+ /**
3
+ * ### SmartMap
4
+ *
5
+ * Like WeakMap but can also store values using primitive keys
6
+ *
7
+ * * * *
8
+ * Example usage:
9
+ * ```typescript
10
+ * import { SmartMap } from "@telperion/js-utils";
11
+ *
12
+ * const aMap = new SmartMap();
13
+ *
14
+ * aMap.set("foo", "foo");
15
+ * aMap.set(1, "thales rocks");
16
+ *
17
+ * console.log(aMap.size) // 2
18
+ *
19
+ * aMap.set({}, "thales rocks again");
20
+ * console.log(aMap.size) // 2
21
+ *
22
+ * const anObject = {};
23
+ * aMap.set(anObject, "thales rocks again and again");
24
+ * console.log(aMap.size) // 3
25
+ * console.log(aMap.get(anObject)) // "thales rocks again and again"
26
+ * ```
27
+ * * * *
28
+ * @template K Typeof Key
29
+ * @template V Typeof Value
30
+ */
31
+ declare class SmartMap<K = any, V = any> extends Map<K, V> {
32
+ /**
33
+ * Symbol refference of weakmap property
34
+ */
35
+ protected static readonly KEY__WEAKMAP: symbol;
36
+ /**
37
+ * Allowed key types to store them in a weakmap instance
38
+ */
39
+ static readonly TYPES_TO_STORE_IN_WEAKMAP: readonly string[];
40
+ /**
41
+ * Returns a boolean whether if the key is storable in weakmap or not
42
+ *
43
+ * @param key Key to check if it can be stored in weakmap
44
+ * @returns A boolean whether if the key is storable in weakmap or not
45
+ */
46
+ protected static isStorableInWeakMap<Key>(key: Key): boolean;
47
+ /**
48
+ * The WeakMap object to store values with associated non-primitive (object) keys
49
+ */
50
+ protected [KEY__WEAKMAP]: WeakMap<NonNullable<K>, V>;
51
+ /**
52
+ * Returns a boolean asserting whether a value has been associated to the key in the SmartMap object or not.
53
+ *
54
+ * @param key The key of the element to test for presence in the SmartMap object.
55
+ * @returns A boolean asserting whether a value has been associated to the key in the SmartMap object or not.
56
+ */
57
+ has(key: K): boolean;
58
+ /**
59
+ * Returns the value associated to the key, or undefined if there is none.
60
+ *
61
+ * @param key The key of the element to return from the SmartMap object.
62
+ * @returns The value associated to the key
63
+ */
64
+ get(key: K): V | undefined;
65
+ /**
66
+ * Sets the value for the key in the SmartMap object.
67
+ *
68
+ * @param key The key of the element to add to the SmartMap object.
69
+ * @param value The value of the element to add to the SmartMap object.
70
+ * @returns Returns the SmartMap object.
71
+ */
72
+ set(key: K, value: V): this;
73
+ /**
74
+ * Removes the associated value from the SmartMap object,
75
+ *
76
+ * @param key The key of the element to remove from the SmartMap object.
77
+ * @returns `true` if an element in the SmartMap object existed and has been removed, or `false` if the element does not exist. `SmartMap.prototype.has(key)` will return false afterwards.
78
+ */
79
+ delete(key: K): boolean;
80
+ }
81
+
82
+ export { SmartMap };
package/smart-map.d.ts CHANGED
@@ -28,7 +28,7 @@ declare const KEY__WEAKMAP: unique symbol;
28
28
  * @template K Typeof Key
29
29
  * @template V Typeof Value
30
30
  */
31
- export declare class SmartMap<K = any, V = any> extends Map<K, V> {
31
+ declare class SmartMap<K = any, V = any> extends Map<K, V> {
32
32
  /**
33
33
  * Symbol refference of weakmap property
34
34
  */
@@ -78,4 +78,5 @@ export declare class SmartMap<K = any, V = any> extends Map<K, V> {
78
78
  */
79
79
  delete(key: K): boolean;
80
80
  }
81
- export {};
81
+
82
+ export { SmartMap };
package/smart-map.js CHANGED
@@ -30,7 +30,7 @@ const KEY__WEAKMAP = Symbol('SmartMap.weakMap');
30
30
  * @template K Typeof Key
31
31
  * @template V Typeof Value
32
32
  */
33
- export class SmartMap extends Map {
33
+ class SmartMap extends Map {
34
34
  /**
35
35
  * Symbol refference of weakmap property
36
36
  */
@@ -103,4 +103,5 @@ export class SmartMap extends Map {
103
103
  }
104
104
  }
105
105
 
106
+ export { SmartMap };
106
107
  //# sourceMappingURL=smart-map.js.map
package/smart-map.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../libs/js-utils/src/smart-map.ts"],"names":[],"mappings":"AAAA,uDAAuD;AAEvD,+EAA+E;AAC/E,MAAM,YAAY,GAAkB,MAAM,CAAC,kBAAkB,CAAC,CAAC;AAE/D;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,OAAO,QAA2B,SAAQ,GAAS;IACvD;;OAEG;IACO,MAAM,CAAU,YAAY,GAAG,YAAY,CAAC;IAEtD;;OAEG;IACI,MAAM,CAAU,yBAAyB,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC,CAAC;IAEzF;;;;;OAKG;IACO,MAAM,CAAC,mBAAmB,CAAM,GAAQ;QAChD,OAAO,GAAG,KAAK,IAAI,IAAI,QAAQ,CAAC,yBAAyB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,GAAG,KAAK,IAAI,CAAC,CAAC;IAC9F,CAAC;IAED;;OAEG;IACO,CAAC,YAAY,CAAC,GAAG,IAAI,OAAO,EAAqB,CAAC;IAE5D;;;;;OAKG;IACM,GAAG,CAAC,GAAM;QACjB,IAAI,QAAQ,CAAC,mBAAmB,CAAC,GAAG,CAAC,EAAE,CAAC;YACtC,OAAO,IAAI,CAAC,YAAY,CAAC,CAAC,GAAG,CAAC,GAAI,CAAC,CAAC;QACtC,CAAC;QAED,OAAO,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACxB,CAAC;IAED;;;;;OAKG;IACM,GAAG,CAAC,GAAM;QACjB,IAAI,QAAQ,CAAC,mBAAmB,CAAC,GAAG,CAAC,EAAE,CAAC;YACtC,OAAO,IAAI,CAAC,YAAY,CAAC,CAAC,GAAG,CAAC,GAAqB,CAAC,CAAC;QACvD,CAAC;QAED,OAAO,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACxB,CAAC;IAED;;;;;;OAMG;IACM,GAAG,CAAC,GAAM,EAAE,KAAQ;QAC3B,IAAI,QAAQ,CAAC,mBAAmB,CAAC,GAAG,CAAC,EAAE,CAAC;YACtC,IAAI,CAAC,YAAY,CAAC,CAAC,GAAG,CAAC,GAAqB,EAAE,KAAK,CAAC,CAAC;QACvD,CAAC;aAAM,CAAC;YACN,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QACxB,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;OAKG;IACM,MAAM,CAAC,GAAM;QACpB,OAAO,IAAI,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,GAAqB,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IAC/E,CAAC","file":"smart-map.js","sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n\n// Symbols to protect overriding private methods & properties of SmartMap Class\nconst KEY__WEAKMAP: unique symbol = Symbol('SmartMap.weakMap');\n\n/**\n * ### SmartMap\n *\n * Like WeakMap but can also store values using primitive keys\n *\n * * * *\n * Example usage:\n * ```typescript\n * import { SmartMap } from \"@telperion/js-utils\";\n *\n * const aMap = new SmartMap();\n *\n * aMap.set(\"foo\", \"foo\");\n * aMap.set(1, \"thales rocks\");\n *\n * console.log(aMap.size) // 2\n *\n * aMap.set({}, \"thales rocks again\");\n * console.log(aMap.size) // 2\n *\n * const anObject = {};\n * aMap.set(anObject, \"thales rocks again and again\");\n * console.log(aMap.size) // 3\n * console.log(aMap.get(anObject)) // \"thales rocks again and again\"\n * ```\n * * * *\n * @template K Typeof Key\n * @template V Typeof Value\n */\nexport class SmartMap<K = any, V = any> extends Map<K, V> {\n /**\n * Symbol refference of weakmap property\n */\n protected static readonly KEY__WEAKMAP = KEY__WEAKMAP;\n\n /**\n * Allowed key types to store them in a weakmap instance\n */\n public static readonly TYPES_TO_STORE_IN_WEAKMAP = Object.freeze(['object', 'function']);\n\n /**\n * Returns a boolean whether if the key is storable in weakmap or not\n *\n * @param key Key to check if it can be stored in weakmap\n * @returns A boolean whether if the key is storable in weakmap or not\n */\n protected static isStorableInWeakMap<Key>(key: Key): boolean {\n return key !== null && SmartMap.TYPES_TO_STORE_IN_WEAKMAP.some(_key => typeof key === _key);\n }\n\n /**\n * The WeakMap object to store values with associated non-primitive (object) keys\n */\n protected [KEY__WEAKMAP] = new WeakMap<NonNullable<K>, V>();\n\n /**\n * Returns a boolean asserting whether a value has been associated to the key in the SmartMap object or not.\n *\n * @param key The key of the element to test for presence in the SmartMap object.\n * @returns A boolean asserting whether a value has been associated to the key in the SmartMap object or not.\n */\n override has(key: K): boolean {\n if (SmartMap.isStorableInWeakMap(key)) {\n return this[KEY__WEAKMAP].has(key!);\n }\n\n return super.has(key);\n }\n\n /**\n * Returns the value associated to the key, or undefined if there is none.\n *\n * @param key The key of the element to return from the SmartMap object.\n * @returns The value associated to the key\n */\n override get(key: K): V | undefined {\n if (SmartMap.isStorableInWeakMap(key)) {\n return this[KEY__WEAKMAP].get(key as NonNullable<K>);\n }\n\n return super.get(key);\n }\n\n /**\n * Sets the value for the key in the SmartMap object.\n *\n * @param key The key of the element to add to the SmartMap object.\n * @param value The value of the element to add to the SmartMap object.\n * @returns Returns the SmartMap object.\n */\n override set(key: K, value: V): this {\n if (SmartMap.isStorableInWeakMap(key)) {\n this[KEY__WEAKMAP].set(key as NonNullable<K>, value);\n } else {\n super.set(key, value);\n }\n\n return this;\n }\n\n /**\n * Removes the associated value from the SmartMap object,\n *\n * @param key The key of the element to remove from the SmartMap object.\n * @returns `true` if an element in the SmartMap object existed and has been removed, or `false` if the element does not exist. `SmartMap.prototype.has(key)` will return false afterwards.\n */\n override delete(key: K): boolean {\n return this[KEY__WEAKMAP].delete(key as NonNullable<K>) || super.delete(key);\n }\n}\n"]}
1
+ {"version":3,"file":"smart-map.js","sources":["../../../libs/js-utils/src/smart-map.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA;AAEA;AACA,MAAM,YAAY,GAAkB,MAAM,CAAC,kBAAkB,CAAC;AAE9D;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BG;AACG,MAAO,QAA2B,SAAQ,GAAS,CAAA;AACvD;;AAEG;AACO,IAAA,OAAgB,YAAY,GAAG,YAAY;AAErD;;AAEG;AACI,IAAA,OAAgB,yBAAyB,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;AAExF;;;;;AAKG;IACO,OAAO,mBAAmB,CAAM,GAAQ,EAAA;AAChD,QAAA,OAAO,GAAG,KAAK,IAAI,IAAI,QAAQ,CAAC,yBAAyB,CAAC,IAAI,CAAC,IAAI,IAAI,OAAO,GAAG,KAAK,IAAI,CAAC;IAC7F;AAEA;;AAEG;AACO,IAAA,CAAC,YAAY,IAAI,IAAI,OAAO,EAAqB;AAE3D;;;;;AAKG;AACM,IAAA,GAAG,CAAC,GAAM,EAAA;AACjB,QAAA,IAAI,QAAQ,CAAC,mBAAmB,CAAC,GAAG,CAAC,EAAE;YACrC,OAAO,IAAI,CAAC,YAAY,CAAC,CAAC,GAAG,CAAC,GAAI,CAAC;QACrC;AAEA,QAAA,OAAO,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC;IACvB;AAEA;;;;;AAKG;AACM,IAAA,GAAG,CAAC,GAAM,EAAA;AACjB,QAAA,IAAI,QAAQ,CAAC,mBAAmB,CAAC,GAAG,CAAC,EAAE;YACrC,OAAO,IAAI,CAAC,YAAY,CAAC,CAAC,GAAG,CAAC,GAAqB,CAAC;QACtD;AAEA,QAAA,OAAO,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC;IACvB;AAEA;;;;;;AAMG;IACM,GAAG,CAAC,GAAM,EAAE,KAAQ,EAAA;AAC3B,QAAA,IAAI,QAAQ,CAAC,mBAAmB,CAAC,GAAG,CAAC,EAAE;YACrC,IAAI,CAAC,YAAY,CAAC,CAAC,GAAG,CAAC,GAAqB,EAAE,KAAK,CAAC;QACtD;aAAO;AACL,YAAA,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC;QACvB;AAEA,QAAA,OAAO,IAAI;IACb;AAEA;;;;;AAKG;AACM,IAAA,MAAM,CAAC,GAAM,EAAA;AACpB,QAAA,OAAO,IAAI,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,GAAqB,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC;IAC9E;;;;;"}
package/string/index.cjs CHANGED
@@ -1,4 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("@telperion/js-utils/string/limit"), exports);
1
+ 'use strict';
2
+
3
+ var string_limit = require('./limit.cjs');
4
+
5
+
6
+
7
+ exports.limit = string_limit.limit;
8
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
@@ -0,0 +1 @@
1
+ export { limit } from './limit.cjs';
package/string/index.d.ts CHANGED
@@ -1 +1 @@
1
- export * from '@telperion/js-utils/string/limit';
1
+ export { limit } from './limit.js';
package/string/index.js CHANGED
@@ -1,3 +1,2 @@
1
- export * from '@telperion/js-utils/string/limit';
2
-
1
+ export { limit } from './limit.js';
3
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../libs/js-utils/src/string/index.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAC","file":"index.js","sourcesContent":["export * from '@telperion/js-utils/string/limit';\n"]}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
package/string/limit.cjs CHANGED
@@ -1,7 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.limit = limit;
4
- const limit_1 = require("@telperion/js-utils/array/limit");
1
+ 'use strict';
2
+
3
+ var array_limit = require('../array/limit.cjs');
4
+
5
5
  /**
6
6
  * #### Limit
7
7
  *
@@ -31,5 +31,8 @@ const limit_1 = require("@telperion/js-utils/array/limit");
31
31
  * @return Limited string
32
32
  */
33
33
  function limit(str, count) {
34
- return (0, limit_1.limit)(str.split(''), count).join('');
34
+ return array_limit.limit(str.split(''), count).join('');
35
35
  }
36
+
37
+ exports.limit = limit;
38
+ //# sourceMappingURL=limit.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"limit.cjs","sources":["../../../../libs/js-utils/src/string/limit.ts"],"sourcesContent":[null],"names":["arrLimit"],"mappings":";;;;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BG;AACG,SAAU,KAAK,CAAC,GAAW,EAAE,KAAa,EAAA;AAC9C,IAAA,OAAOA,iBAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;AAChD;;;;"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * #### Limit
3
+ *
4
+ * Limits the string to `n` character
5
+ *
6
+ * * * *
7
+ * Example:
8
+ * ```typescript
9
+ * import { limit } from "@telperion/js-utils/string";
10
+ *
11
+ * const str = 'foobarbaz';
12
+ *
13
+ * limit(str, 3); // 'foo'
14
+ * ```
15
+ *
16
+ * Prototype Example:
17
+ * ```typescript
18
+ * import "@telperion/js-utils/string/proto/limit";
19
+ *
20
+ * const str = 'foobarbaz';
21
+ *
22
+ * str.limit(3); // 'foo'
23
+ * ```
24
+ * * * *
25
+ * @param str: String to limit
26
+ * @param count Count to limit string character size
27
+ * @return Limited string
28
+ */
29
+ declare function limit(str: string, count: number): string;
30
+
31
+ export { limit };
package/string/limit.d.ts CHANGED
@@ -26,4 +26,6 @@
26
26
  * @param count Count to limit string character size
27
27
  * @return Limited string
28
28
  */
29
- export declare function limit(str: string, count: number): string;
29
+ declare function limit(str: string, count: number): string;
30
+
31
+ export { limit };
package/string/limit.js CHANGED
@@ -1,4 +1,5 @@
1
- import { limit as arrLimit } from '@telperion/js-utils/array/limit';
1
+ import { limit as limit$1 } from '../array/limit.js';
2
+
2
3
  /**
3
4
  * #### Limit
4
5
  *
@@ -27,8 +28,9 @@ import { limit as arrLimit } from '@telperion/js-utils/array/limit';
27
28
  * @param count Count to limit string character size
28
29
  * @return Limited string
29
30
  */
30
- export function limit(str, count) {
31
- return arrLimit(str.split(''), count).join('');
31
+ function limit(str, count) {
32
+ return limit$1(str.split(''), count).join('');
32
33
  }
33
34
 
35
+ export { limit };
34
36
  //# sourceMappingURL=limit.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../libs/js-utils/src/string/limit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAEpE;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,UAAU,KAAK,CAAC,GAAW,EAAE,KAAa;IAC9C,OAAO,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACjD,CAAC","file":"limit.js","sourcesContent":["import { limit as arrLimit } from '@telperion/js-utils/array/limit';\n\n/**\n * #### Limit\n *\n * Limits the string to `n` character\n *\n * * * *\n * Example:\n * ```typescript\n * import { limit } from \"@telperion/js-utils/string\";\n *\n * const str = 'foobarbaz';\n *\n * limit(str, 3); // 'foo'\n * ```\n *\n * Prototype Example:\n * ```typescript\n * import \"@telperion/js-utils/string/proto/limit\";\n *\n * const str = 'foobarbaz';\n *\n * str.limit(3); // 'foo'\n * ```\n * * * *\n * @param str: String to limit\n * @param count Count to limit string character size\n * @return Limited string\n */\nexport function limit(str: string, count: number): string {\n return arrLimit(str.split(''), count).join('');\n}\n"]}
1
+ {"version":3,"file":"limit.js","sources":["../../../../libs/js-utils/src/string/limit.ts"],"sourcesContent":[null],"names":["arrLimit"],"mappings":";;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BG;AACG,SAAU,KAAK,CAAC,GAAW,EAAE,KAAa,EAAA;AAC9C,IAAA,OAAOA,OAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;AAChD;;;;"}
@@ -1,6 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const limit_1 = require("@telperion/js-utils/string/limit");
1
+ 'use strict';
2
+
3
+ var string_limit = require('../limit.cjs');
4
+
4
5
  String.prototype.limit = function (...args) {
5
- return (0, limit_1.limit)(this, ...args);
6
+ return string_limit.limit(this, ...args);
6
7
  };
8
+ //# sourceMappingURL=limit.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"limit.cjs","sources":["../../../../../libs/js-utils/src/string/proto/limit.ts"],"sourcesContent":[null],"names":["limit"],"mappings":";;;;AAiCA,MAAM,CAAC,SAAS,CAAC,KAAK,GAAG,UAAwB,GAAG,IAAe,EAAA;AACjE,IAAA,OAAOA,kBAAK,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC;AAC7B,CAAC;;"}
@@ -0,0 +1,30 @@
1
+ import { Tail } from '@telperion/extra-ts-types';
2
+ import { limit } from '../limit.cjs';
3
+
4
+ type FuncType = typeof limit;
5
+ type FuncArgs = Parameters<FuncType>;
6
+ type FuncReturn = ReturnType<FuncType>;
7
+ type ProtoArgs = Tail<FuncArgs>;
8
+ declare global {
9
+ export interface String {
10
+ /**
11
+ * #### Limit
12
+ *
13
+ * Limits the string to `n` character
14
+ *
15
+ * * * *
16
+ * Example:
17
+ * ```typescript
18
+ * import "@telperion/js-utils/string/proto/limit";
19
+ *
20
+ * const str = 'foobarbaz';
21
+ *
22
+ * str.limit(3); // 'foo'
23
+ * ```
24
+ * * * *
25
+ * @param count Count to limit string character size
26
+ * @return Limited string
27
+ */
28
+ limit(...args: ProtoArgs): FuncReturn;
29
+ }
30
+ }
@@ -1,5 +1,6 @@
1
- import type { Tail } from '@telperion/extra-ts-types';
2
- import { limit } from '@telperion/js-utils/string/limit';
1
+ import { Tail } from '@telperion/extra-ts-types';
2
+ import { limit } from '../limit.js';
3
+
3
4
  type FuncType = typeof limit;
4
5
  type FuncArgs = Parameters<FuncType>;
5
6
  type FuncReturn = ReturnType<FuncType>;
@@ -27,4 +28,3 @@ declare global {
27
28
  limit(...args: ProtoArgs): FuncReturn;
28
29
  }
29
30
  }
30
- export {};
@@ -1,6 +1,6 @@
1
- import { limit } from '@telperion/js-utils/string/limit';
1
+ import { limit } from '../limit.js';
2
+
2
3
  String.prototype.limit = function (...args) {
3
4
  return limit(this, ...args);
4
5
  };
5
-
6
6
  //# sourceMappingURL=limit.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../libs/js-utils/src/string/proto/limit.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,kCAAkC,CAAC;AA+BzD,MAAM,CAAC,SAAS,CAAC,KAAK,GAAG,UAAwB,GAAG,IAAe;IACjE,OAAO,KAAK,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,CAAC;AAC9B,CAAC,CAAC","file":"limit.js","sourcesContent":["import type { Tail } from '@telperion/extra-ts-types';\n\nimport { limit } from '@telperion/js-utils/string/limit';\n\ntype FuncType = typeof limit;\ntype FuncArgs = Parameters<FuncType>;\ntype FuncReturn = ReturnType<FuncType>;\ntype ProtoArgs = Tail<FuncArgs>;\n\ndeclare global {\n export interface String {\n /**\n * #### Limit\n *\n * Limits the string to `n` character\n *\n * * * *\n * Example:\n * ```typescript\n * import \"@telperion/js-utils/string/proto/limit\";\n *\n * const str = 'foobarbaz';\n *\n * str.limit(3); // 'foo'\n * ```\n * * * *\n * @param count Count to limit string character size\n * @return Limited string\n */\n limit(...args: ProtoArgs): FuncReturn;\n }\n}\n\nString.prototype.limit = function (this: string, ...args: ProtoArgs): FuncReturn {\n return limit(this, ...args);\n};\n"]}
1
+ {"version":3,"file":"limit.js","sources":["../../../../../libs/js-utils/src/string/proto/limit.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAiCA,MAAM,CAAC,SAAS,CAAC,KAAK,GAAG,UAAwB,GAAG,IAAe,EAAA;AACjE,IAAA,OAAO,KAAK,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC;AAC7B,CAAC"}
package/time/days.cjs CHANGED
@@ -1,7 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.days = days;
4
- const hours_1 = require("@telperion/js-utils/time/hours");
1
+ 'use strict';
2
+
3
+ var time_hours = require('./hours.cjs');
4
+
5
5
  /**
6
6
  * Converts days to milliseconds
7
7
  *
@@ -17,5 +17,8 @@ const hours_1 = require("@telperion/js-utils/time/hours");
17
17
  * @returns Equivalent value in milliseconds
18
18
  */
19
19
  function days(value) {
20
- return (0, hours_1.hours)(value) * 24;
20
+ return time_hours.hours(value) * 24;
21
21
  }
22
+
23
+ exports.days = days;
24
+ //# sourceMappingURL=days.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"days.cjs","sources":["../../../../libs/js-utils/src/time/days.ts"],"sourcesContent":[null],"names":["hours"],"mappings":";;;;AAEA;;;;;;;;;;;;;AAaG;AACG,SAAU,IAAI,CAAC,KAAa,EAAA;AAChC,IAAA,OAAOA,gBAAK,CAAC,KAAK,CAAC,GAAG,EAAE;AAC1B;;;;"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Converts days to milliseconds
3
+ *
4
+ * #### Example
5
+ * ```typescript
6
+ * import { days } from "@telperion/js-utils/time";
7
+ *
8
+ * const expiryTime = Date.now() + days(7); // 7 days from now
9
+ * console.log(new Date(expiryTime));
10
+ * ```
11
+ *
12
+ * @param value - Number of days
13
+ * @returns Equivalent value in milliseconds
14
+ */
15
+ declare function days(value: number): number;
16
+
17
+ export { days };
package/time/days.d.ts CHANGED
@@ -12,4 +12,6 @@
12
12
  * @param value - Number of days
13
13
  * @returns Equivalent value in milliseconds
14
14
  */
15
- export declare function days(value: number): number;
15
+ declare function days(value: number): number;
16
+
17
+ export { days };
package/time/days.js CHANGED
@@ -1,4 +1,5 @@
1
- import { hours } from "@telperion/js-utils/time/hours";
1
+ import { hours } from './hours.js';
2
+
2
3
  /**
3
4
  * Converts days to milliseconds
4
5
  *
@@ -13,8 +14,9 @@ import { hours } from "@telperion/js-utils/time/hours";
13
14
  * @param value - Number of days
14
15
  * @returns Equivalent value in milliseconds
15
16
  */
16
- export function days(value) {
17
+ function days(value) {
17
18
  return hours(value) * 24;
18
19
  }
19
20
 
21
+ export { days };
20
22
  //# sourceMappingURL=days.js.map
package/time/days.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../libs/js-utils/src/time/days.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,gCAAgC,CAAC;AAEvD;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,IAAI,CAAC,KAAa;IAChC,OAAO,KAAK,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;AAC3B,CAAC","file":"days.js","sourcesContent":["import { hours } from \"@telperion/js-utils/time/hours\";\r\n\r\n/**\r\n * Converts days to milliseconds\r\n *\r\n * #### Example\r\n * ```typescript\r\n * import { days } from \"@telperion/js-utils/time\";\r\n *\r\n * const expiryTime = Date.now() + days(7); // 7 days from now\r\n * console.log(new Date(expiryTime));\r\n * ```\r\n *\r\n * @param value - Number of days\r\n * @returns Equivalent value in milliseconds\r\n */\r\nexport function days(value: number): number {\r\n return hours(value) * 24;\r\n}\r\n"]}
1
+ {"version":3,"file":"days.js","sources":["../../../../libs/js-utils/src/time/days.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAEA;;;;;;;;;;;;;AAaG;AACG,SAAU,IAAI,CAAC,KAAa,EAAA;AAChC,IAAA,OAAO,KAAK,CAAC,KAAK,CAAC,GAAG,EAAE;AAC1B;;;;"}
package/time/hours.cjs CHANGED
@@ -1,7 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.hours = hours;
4
- const minutes_1 = require("@telperion/js-utils/time/minutes");
1
+ 'use strict';
2
+
3
+ var time_minutes = require('./minutes.cjs');
4
+
5
5
  /**
6
6
  * Converts hours to milliseconds
7
7
  *
@@ -17,5 +17,8 @@ const minutes_1 = require("@telperion/js-utils/time/minutes");
17
17
  * @returns Equivalent value in milliseconds
18
18
  */
19
19
  function hours(value) {
20
- return (0, minutes_1.minutes)(value) * 60;
20
+ return time_minutes.minutes(value) * 60;
21
21
  }
22
+
23
+ exports.hours = hours;
24
+ //# sourceMappingURL=hours.cjs.map