@choksheak/ts-utils 0.2.9 → 0.3.1

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 (315) hide show
  1. package/README.md +2 -0
  2. package/{arrayBuffer.js → arrayBuffer.cjs} +0 -1
  3. package/arrayBuffer.d.mts +10 -0
  4. package/arrayBuffer.d.ts +4 -2
  5. package/arrayBuffer.min.cjs +2 -0
  6. package/arrayBuffer.min.cjs.map +1 -0
  7. package/arrayBuffer.min.mjs +2 -0
  8. package/{arrayBuffer.js.map → arrayBuffer.min.mjs.map} +1 -1
  9. package/arrayBuffer.mjs +14 -0
  10. package/{assert.js → assert.cjs} +0 -1
  11. package/assert.d.mts +7 -0
  12. package/assert.d.ts +3 -1
  13. package/assert.min.cjs +2 -0
  14. package/assert.min.cjs.map +1 -0
  15. package/assert.min.mjs +2 -0
  16. package/{assert.js.map → assert.min.mjs.map} +1 -1
  17. package/assert.mjs +11 -0
  18. package/{average.js → average.cjs} +0 -1
  19. package/average.d.mts +7 -0
  20. package/average.d.ts +3 -1
  21. package/average.min.cjs +2 -0
  22. package/{average.js.map → average.min.cjs.map} +1 -1
  23. package/average.min.mjs +2 -0
  24. package/average.min.mjs.map +1 -0
  25. package/average.mjs +20 -0
  26. package/{base64Url.js → base64Url.cjs} +0 -1
  27. package/base64Url.d.mts +10 -0
  28. package/base64Url.d.ts +4 -2
  29. package/base64Url.min.cjs +2 -0
  30. package/base64Url.min.cjs.map +1 -0
  31. package/base64Url.min.mjs +2 -0
  32. package/{base64Url.js.map → base64Url.min.mjs.map} +1 -1
  33. package/base64Url.mjs +14 -0
  34. package/{dateTimeStr.js → dateTimeStr.cjs} +0 -1
  35. package/dateTimeStr.d.mts +85 -0
  36. package/dateTimeStr.d.ts +15 -13
  37. package/dateTimeStr.min.cjs +2 -0
  38. package/dateTimeStr.min.cjs.map +1 -0
  39. package/dateTimeStr.min.mjs +2 -0
  40. package/{dateTimeStr.js.map → dateTimeStr.min.mjs.map} +1 -1
  41. package/dateTimeStr.mjs +83 -0
  42. package/{duration.js → duration.cjs} +9 -11
  43. package/duration.d.mts +78 -0
  44. package/duration.d.ts +15 -13
  45. package/duration.min.cjs +2 -0
  46. package/duration.min.cjs.map +1 -0
  47. package/duration.min.mjs +2 -0
  48. package/duration.min.mjs.map +1 -0
  49. package/duration.mjs +154 -0
  50. package/{isEmpty.js → isEmpty.cjs} +0 -1
  51. package/isEmpty.d.mts +6 -0
  52. package/isEmpty.d.ts +3 -1
  53. package/isEmpty.min.cjs +2 -0
  54. package/isEmpty.min.cjs.map +1 -0
  55. package/isEmpty.min.mjs +2 -0
  56. package/{isEmpty.js.map → isEmpty.min.mjs.map} +1 -1
  57. package/isEmpty.mjs +22 -0
  58. package/iterators.cjs +34 -0
  59. package/iterators.d.mts +4 -0
  60. package/iterators.d.ts +4 -0
  61. package/iterators.min.cjs +2 -0
  62. package/iterators.min.cjs.map +1 -0
  63. package/iterators.min.mjs +2 -0
  64. package/iterators.min.mjs.map +1 -0
  65. package/iterators.mjs +9 -0
  66. package/kvStore.cjs +365 -0
  67. package/kvStore.d.mts +139 -0
  68. package/kvStore.d.ts +95 -50
  69. package/kvStore.min.cjs +2 -0
  70. package/kvStore.min.cjs.map +1 -0
  71. package/kvStore.min.mjs +2 -0
  72. package/kvStore.min.mjs.map +1 -0
  73. package/kvStore.mjs +333 -0
  74. package/localStore.cjs +267 -0
  75. package/localStore.d.mts +119 -0
  76. package/localStore.d.ts +119 -0
  77. package/localStore.min.cjs +2 -0
  78. package/localStore.min.cjs.map +1 -0
  79. package/localStore.min.mjs +2 -0
  80. package/localStore.min.mjs.map +1 -0
  81. package/localStore.mjs +235 -0
  82. package/{logging.js → logging.cjs} +0 -1
  83. package/logging.d.mts +4 -0
  84. package/logging.d.ts +4 -2
  85. package/logging.min.cjs +2 -0
  86. package/logging.min.cjs.map +1 -0
  87. package/logging.min.mjs +2 -0
  88. package/{logging.js.map → logging.min.mjs.map} +1 -1
  89. package/logging.mjs +21 -0
  90. package/{nonEmpty.js → nonEmpty.cjs} +0 -1
  91. package/nonEmpty.d.mts +10 -0
  92. package/nonEmpty.d.ts +3 -1
  93. package/nonEmpty.min.cjs +2 -0
  94. package/{nonEmpty.js.map → nonEmpty.min.cjs.map} +1 -1
  95. package/nonEmpty.min.mjs +2 -0
  96. package/nonEmpty.min.mjs.map +1 -0
  97. package/nonEmpty.mjs +30 -0
  98. package/{nonNil.js → nonNil.cjs} +0 -1
  99. package/{src/nonNil.ts → nonNil.d.mts} +3 -6
  100. package/nonNil.d.ts +3 -1
  101. package/nonNil.min.cjs +2 -0
  102. package/nonNil.min.cjs.map +1 -0
  103. package/nonNil.min.mjs +2 -0
  104. package/{nonNil.js.map → nonNil.min.mjs.map} +1 -1
  105. package/nonNil.mjs +10 -0
  106. package/package.json +447 -24
  107. package/{round.js → round.cjs} +0 -1
  108. package/{src/round.ts → round.d.mts} +4 -8
  109. package/round.d.ts +4 -2
  110. package/round.min.cjs +2 -0
  111. package/round.min.cjs.map +1 -0
  112. package/round.min.mjs +2 -0
  113. package/{round.js.map → round.min.mjs.map} +1 -1
  114. package/round.mjs +12 -0
  115. package/{safeBtoa.js → safeBtoa.cjs} +0 -1
  116. package/safeBtoa.d.mts +6 -0
  117. package/safeBtoa.d.ts +3 -1
  118. package/safeBtoa.min.cjs +2 -0
  119. package/safeBtoa.min.cjs.map +1 -0
  120. package/safeBtoa.min.mjs +2 -0
  121. package/{safeBtoa.js.map → safeBtoa.min.mjs.map} +1 -1
  122. package/safeBtoa.mjs +9 -0
  123. package/{safeParseFloat.js → safeParseFloat.cjs} +0 -1
  124. package/safeParseFloat.d.mts +6 -0
  125. package/safeParseFloat.d.ts +3 -1
  126. package/safeParseFloat.min.cjs +2 -0
  127. package/safeParseFloat.min.cjs.map +1 -0
  128. package/safeParseFloat.min.mjs +2 -0
  129. package/{safeParseFloat.js.map → safeParseFloat.min.mjs.map} +1 -1
  130. package/safeParseFloat.mjs +8 -0
  131. package/{safeParseInt.js → safeParseInt.cjs} +0 -1
  132. package/safeParseInt.d.mts +6 -0
  133. package/safeParseInt.d.ts +3 -1
  134. package/safeParseInt.min.cjs +2 -0
  135. package/safeParseInt.min.cjs.map +1 -0
  136. package/safeParseInt.min.mjs +2 -0
  137. package/{safeParseInt.js.map → safeParseInt.min.mjs.map} +1 -1
  138. package/safeParseInt.mjs +8 -0
  139. package/sha256.cjs +35 -0
  140. package/sha256.d.mts +6 -0
  141. package/sha256.d.ts +3 -1
  142. package/sha256.min.cjs +2 -0
  143. package/sha256.min.cjs.map +1 -0
  144. package/sha256.min.mjs +2 -0
  145. package/{sha256.js.map → sha256.min.mjs.map} +1 -1
  146. package/sha256.mjs +10 -0
  147. package/{sleep.js → sleep.cjs} +0 -1
  148. package/{src/sleep.ts → sleep.d.mts} +3 -3
  149. package/sleep.d.ts +3 -1
  150. package/sleep.min.cjs +2 -0
  151. package/sleep.min.cjs.map +1 -0
  152. package/sleep.min.mjs +2 -0
  153. package/{sleep.js.map → sleep.min.mjs.map} +1 -1
  154. package/sleep.mjs +7 -0
  155. package/storageAdapter.cjs +18 -0
  156. package/storageAdapter.d.mts +33 -0
  157. package/storageAdapter.d.ts +33 -0
  158. package/storageAdapter.min.cjs +2 -0
  159. package/storageAdapter.min.cjs.map +1 -0
  160. package/storageAdapter.min.mjs +1 -0
  161. package/storageAdapter.min.mjs.map +1 -0
  162. package/storageAdapter.mjs +0 -0
  163. package/{sum.js → sum.cjs} +0 -1
  164. package/sum.d.mts +7 -0
  165. package/sum.d.ts +3 -1
  166. package/sum.min.cjs +2 -0
  167. package/sum.min.cjs.map +1 -0
  168. package/sum.min.mjs +2 -0
  169. package/{sum.js.map → sum.min.mjs.map} +1 -1
  170. package/sum.mjs +13 -0
  171. package/{timeConstants.js → timeConstants.cjs} +0 -1
  172. package/timeConstants.d.mts +20 -0
  173. package/timeConstants.d.ts +16 -14
  174. package/timeConstants.min.cjs +2 -0
  175. package/timeConstants.min.cjs.map +1 -0
  176. package/timeConstants.min.mjs +2 -0
  177. package/{timeConstants.js.map → timeConstants.min.mjs.map} +1 -1
  178. package/timeConstants.mjs +31 -0
  179. package/{timer.js → timer.cjs} +6 -6
  180. package/timer.d.mts +13 -0
  181. package/timer.d.ts +4 -2
  182. package/timer.min.cjs +2 -0
  183. package/timer.min.cjs.map +1 -0
  184. package/timer.min.mjs +2 -0
  185. package/timer.min.mjs.map +1 -0
  186. package/timer.mjs +161 -0
  187. package/docs/.nojekyll +0 -1
  188. package/docs/assets/hierarchy.js +0 -1
  189. package/docs/assets/highlight.css +0 -22
  190. package/docs/assets/icons.js +0 -18
  191. package/docs/assets/icons.svg +0 -1
  192. package/docs/assets/main.js +0 -60
  193. package/docs/assets/navigation.js +0 -1
  194. package/docs/assets/search.js +0 -1
  195. package/docs/assets/style.css +0 -1640
  196. package/docs/classes/kvStore.KVStore.html +0 -26
  197. package/docs/classes/kvStore.KVStoreField.html +0 -7
  198. package/docs/classes/timer.Timer.html +0 -8
  199. package/docs/functions/arrayBuffer.arrayBufferToBase64.html +0 -2
  200. package/docs/functions/arrayBuffer.arrayBufferToHex.html +0 -2
  201. package/docs/functions/assert.assert.html +0 -3
  202. package/docs/functions/average.average.html +0 -3
  203. package/docs/functions/base64Url.base64ToBase64URL.html +0 -2
  204. package/docs/functions/base64Url.base64UrlToBase64.html +0 -2
  205. package/docs/functions/dateTimeStr.getDisplayDateTime.html +0 -3
  206. package/docs/functions/dateTimeStr.getLongMonthNameOneIndexed.html +0 -4
  207. package/docs/functions/dateTimeStr.getLongMonthNameZeroIndexed.html +0 -4
  208. package/docs/functions/dateTimeStr.getShortMonthNameOneIndexed.html +0 -4
  209. package/docs/functions/dateTimeStr.getShortMonthNameZeroIndexed.html +0 -4
  210. package/docs/functions/dateTimeStr.hhMm.html +0 -4
  211. package/docs/functions/dateTimeStr.hhMmSs.html +0 -4
  212. package/docs/functions/dateTimeStr.hhMmSsMs.html +0 -5
  213. package/docs/functions/dateTimeStr.toDate.html +0 -4
  214. package/docs/functions/dateTimeStr.tzShort.html +0 -4
  215. package/docs/functions/dateTimeStr.yyyyMm.html +0 -4
  216. package/docs/functions/dateTimeStr.yyyyMmDd.html +0 -4
  217. package/docs/functions/duration.durationOrMsToMs.html +0 -2
  218. package/docs/functions/duration.durationToMs.html +0 -2
  219. package/docs/functions/duration.elapsed.html +0 -2
  220. package/docs/functions/duration.formatDuration.html +0 -4
  221. package/docs/functions/duration.msToDuration.html +0 -5
  222. package/docs/functions/duration.readableDuration.html +0 -4
  223. package/docs/functions/isEmpty.isEmpty.html +0 -2
  224. package/docs/functions/kvStore.kvStoreItem.html +0 -2
  225. package/docs/functions/localStorageCache.storeItem.html +0 -15
  226. package/docs/functions/logging.capLength.html +0 -1
  227. package/docs/functions/logging.stringify.html +0 -1
  228. package/docs/functions/nonEmpty.nonEmpty.html +0 -5
  229. package/docs/functions/nonNil.nonNil.html +0 -5
  230. package/docs/functions/round.round.html +0 -5
  231. package/docs/functions/round.roundS.html +0 -3
  232. package/docs/functions/safeBtoa.safeBtoa.html +0 -2
  233. package/docs/functions/safeParseFloat.safeParseFloat.html +0 -2
  234. package/docs/functions/safeParseInt.safeParseInt.html +0 -2
  235. package/docs/functions/sha256.sha256.html +0 -2
  236. package/docs/functions/sleep.sleep.html +0 -3
  237. package/docs/functions/sum.sum.html +0 -3
  238. package/docs/functions/timer.timer.html +0 -2
  239. package/docs/hierarchy.html +0 -1
  240. package/docs/index.html +0 -4
  241. package/docs/modules/arrayBuffer.html +0 -1
  242. package/docs/modules/assert.html +0 -1
  243. package/docs/modules/average.html +0 -1
  244. package/docs/modules/base64Url.html +0 -1
  245. package/docs/modules/dateTimeStr.html +0 -1
  246. package/docs/modules/duration.html +0 -1
  247. package/docs/modules/isEmpty.html +0 -1
  248. package/docs/modules/kvStore.html +0 -1
  249. package/docs/modules/localStorageCache.html +0 -1
  250. package/docs/modules/logging.html +0 -1
  251. package/docs/modules/nonEmpty.html +0 -1
  252. package/docs/modules/nonNil.html +0 -1
  253. package/docs/modules/round.html +0 -1
  254. package/docs/modules/safeBtoa.html +0 -1
  255. package/docs/modules/safeParseFloat.html +0 -1
  256. package/docs/modules/safeParseInt.html +0 -1
  257. package/docs/modules/sha256.html +0 -1
  258. package/docs/modules/sleep.html +0 -1
  259. package/docs/modules/sum.html +0 -1
  260. package/docs/modules/timeConstants.html +0 -1
  261. package/docs/modules/timer.html +0 -1
  262. package/docs/modules.html +0 -1
  263. package/docs/types/dateTimeStr.AnyDateTime.html +0 -1
  264. package/docs/types/duration.Duration.html +0 -6
  265. package/docs/types/duration.DurationStyle.html +0 -6
  266. package/docs/types/duration.DurationSuffixMap.html +0 -6
  267. package/docs/types/duration.DurationSuffixType.html +0 -1
  268. package/docs/types/duration.DurationType.html +0 -2
  269. package/docs/types/localStorageCache.StoredItem.html +0 -4
  270. package/docs/variables/duration.DURATION_STYLE_SUFFIX_MAP.html +0 -1
  271. package/docs/variables/duration.DURATION_TYPE_SEQUENCE.html +0 -2
  272. package/docs/variables/kvStore.DEFAULT_EXPIRY_DELTA_MS.html +0 -2
  273. package/docs/variables/kvStore.GC_INTERVAL_MS.html +0 -2
  274. package/docs/variables/kvStore.MILLIS_PER_DAY.html +0 -2
  275. package/docs/variables/kvStore.kvStore.html +0 -3
  276. package/docs/variables/timeConstants.HOURS_PER_DAY.html +0 -1
  277. package/docs/variables/timeConstants.HOURS_PER_WEEK.html +0 -1
  278. package/docs/variables/timeConstants.MINUTES_PER_DAY.html +0 -1
  279. package/docs/variables/timeConstants.MINUTES_PER_HOUR.html +0 -1
  280. package/docs/variables/timeConstants.MINUTES_PER_WEEK.html +0 -1
  281. package/docs/variables/timeConstants.MS_PER_DAY.html +0 -1
  282. package/docs/variables/timeConstants.MS_PER_HOUR.html +0 -1
  283. package/docs/variables/timeConstants.MS_PER_MINUTE.html +0 -1
  284. package/docs/variables/timeConstants.MS_PER_SECOND.html +0 -3
  285. package/docs/variables/timeConstants.MS_PER_WEEK.html +0 -1
  286. package/docs/variables/timeConstants.SECONDS_PER_DAY.html +0 -1
  287. package/docs/variables/timeConstants.SECONDS_PER_HOUR.html +0 -1
  288. package/docs/variables/timeConstants.SECONDS_PER_MINUTE.html +0 -1
  289. package/docs/variables/timeConstants.SECONDS_PER_WEEK.html +0 -1
  290. package/duration.js.map +0 -1
  291. package/kvStore.js +0 -383
  292. package/kvStore.js.map +0 -1
  293. package/localStorageCache.d.ts +0 -55
  294. package/localStorageCache.js +0 -121
  295. package/localStorageCache.js.map +0 -1
  296. package/sha256.js +0 -58
  297. package/src/arrayBuffer.ts +0 -29
  298. package/src/assert.ts +0 -14
  299. package/src/average.ts +0 -13
  300. package/src/base64Url.ts +0 -20
  301. package/src/dateTimeStr.ts +0 -184
  302. package/src/duration.ts +0 -260
  303. package/src/isEmpty.ts +0 -32
  304. package/src/kvStore.ts +0 -444
  305. package/src/localStorageCache.ts +0 -121
  306. package/src/logging.ts +0 -26
  307. package/src/nonEmpty.ts +0 -18
  308. package/src/safeBtoa.ts +0 -15
  309. package/src/safeParseFloat.ts +0 -10
  310. package/src/safeParseInt.ts +0 -10
  311. package/src/sha256.ts +0 -13
  312. package/src/sum.ts +0 -17
  313. package/src/timeConstants.ts +0 -22
  314. package/src/timer.ts +0 -33
  315. package/timer.js.map +0 -1
@@ -4,15 +4,11 @@
4
4
  * at the end. To show the exact number of decimal places, you'll need to use
5
5
  * toFixed(). E.g. round(1.20, 2).toFixed(2).
6
6
  */
7
- export function round(n: number, numDecimalPlaces = 0): number {
8
- const multipler = Math.pow(10, numDecimalPlaces);
9
- return Math.round(n * multipler) / multipler;
10
- }
11
-
7
+ declare function round(n: number, numDecimalPlaces?: number): number;
12
8
  /**
13
9
  * Returns a string with the number in the exact number of decimal places
14
10
  * specified, in case the number ends with zeroes.
15
11
  */
16
- export function roundS(n: number, numDecimalPlaces = 0): string {
17
- return round(n, numDecimalPlaces).toFixed(numDecimalPlaces);
18
- }
12
+ declare function roundS(n: number, numDecimalPlaces?: number): string;
13
+
14
+ export { round, roundS };
package/round.d.ts CHANGED
@@ -4,9 +4,11 @@
4
4
  * at the end. To show the exact number of decimal places, you'll need to use
5
5
  * toFixed(). E.g. round(1.20, 2).toFixed(2).
6
6
  */
7
- export declare function round(n: number, numDecimalPlaces?: number): number;
7
+ declare function round(n: number, numDecimalPlaces?: number): number;
8
8
  /**
9
9
  * Returns a string with the number in the exact number of decimal places
10
10
  * specified, in case the number ends with zeroes.
11
11
  */
12
- export declare function roundS(n: number, numDecimalPlaces?: number): string;
12
+ declare function roundS(n: number, numDecimalPlaces?: number): string;
13
+
14
+ export { round, roundS };
package/round.min.cjs ADDED
@@ -0,0 +1,2 @@
1
+ "use strict";var u=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var b=Object.prototype.hasOwnProperty;var x=(n,r)=>{for(var t in r)u(n,t,{get:r[t],enumerable:!0})},f=(n,r,t,e)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of p(r))!b.call(n,o)&&o!==t&&u(n,o,{get:()=>r[o],enumerable:!(e=i(r,o))||e.enumerable});return n};var h=n=>f(u({},"__esModule",{value:!0}),n);var M={};x(M,{round:()=>d,roundS:()=>m});module.exports=h(M);function d(n,r=0){let t=Math.pow(10,r);return Math.round(n*t)/t}function m(n,r=0){return d(n,r).toFixed(r)}0&&(module.exports={round,roundS});
2
+ //# sourceMappingURL=round.min.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/round.ts"],"sourcesContent":["/**\n * Simplifies rounding of floating point numbers. Note that if your number ends\n * with zeros, and you convert the number to string, you will lose the zeroes\n * at the end. To show the exact number of decimal places, you'll need to use\n * toFixed(). E.g. round(1.20, 2).toFixed(2).\n */\nexport function round(n: number, numDecimalPlaces = 0): number {\n const multipler = Math.pow(10, numDecimalPlaces);\n return Math.round(n * multipler) / multipler;\n}\n\n/**\n * Returns a string with the number in the exact number of decimal places\n * specified, in case the number ends with zeroes.\n */\nexport function roundS(n: number, numDecimalPlaces = 0): string {\n return round(n, numDecimalPlaces).toFixed(numDecimalPlaces);\n}\n"],"mappings":"yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,WAAAE,EAAA,WAAAC,IAAA,eAAAC,EAAAJ,GAMO,SAASE,EAAM,EAAWG,EAAmB,EAAW,CAC7D,IAAMC,EAAY,KAAK,IAAI,GAAID,CAAgB,EAC/C,OAAO,KAAK,MAAM,EAAIC,CAAS,EAAIA,CACrC,CAMO,SAASH,EAAO,EAAWE,EAAmB,EAAW,CAC9D,OAAOH,EAAM,EAAGG,CAAgB,EAAE,QAAQA,CAAgB,CAC5D","names":["round_exports","__export","round","roundS","__toCommonJS","numDecimalPlaces","multipler"]}
package/round.min.mjs ADDED
@@ -0,0 +1,2 @@
1
+ function o(n,r=0){let t=Math.pow(10,r);return Math.round(n*t)/t}function u(n,r=0){return o(n,r).toFixed(r)}export{o as round,u as roundS};
2
+ //# sourceMappingURL=round.min.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/round.ts"],"sourcesContent":["/**\n * Simplifies rounding of floating point numbers. Note that if your number ends\n * with zeros, and you convert the number to string, you will lose the zeroes\n * at the end. To show the exact number of decimal places, you'll need to use\n * toFixed(). E.g. round(1.20, 2).toFixed(2).\n */\nexport function round(n: number, numDecimalPlaces = 0): number {\n const multipler = Math.pow(10, numDecimalPlaces);\n return Math.round(n * multipler) / multipler;\n}\n\n/**\n * Returns a string with the number in the exact number of decimal places\n * specified, in case the number ends with zeroes.\n */\nexport function roundS(n: number, numDecimalPlaces = 0): string {\n return round(n, numDecimalPlaces).toFixed(numDecimalPlaces);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAMO,SAAS,MAAM,GAAW,mBAAmB,GAAW;AAC7D,QAAM,YAAY,KAAK,IAAI,IAAI,gBAAgB;AAC/C,SAAO,KAAK,MAAM,IAAI,SAAS,IAAI;AACrC;AAMO,SAAS,OAAO,GAAW,mBAAmB,GAAW;AAC9D,SAAO,MAAM,GAAG,gBAAgB,EAAE,QAAQ,gBAAgB;AAC5D;","names":[]}
1
+ {"version":3,"sources":["../src/round.ts"],"sourcesContent":["/**\n * Simplifies rounding of floating point numbers. Note that if your number ends\n * with zeros, and you convert the number to string, you will lose the zeroes\n * at the end. To show the exact number of decimal places, you'll need to use\n * toFixed(). E.g. round(1.20, 2).toFixed(2).\n */\nexport function round(n: number, numDecimalPlaces = 0): number {\n const multipler = Math.pow(10, numDecimalPlaces);\n return Math.round(n * multipler) / multipler;\n}\n\n/**\n * Returns a string with the number in the exact number of decimal places\n * specified, in case the number ends with zeroes.\n */\nexport function roundS(n: number, numDecimalPlaces = 0): string {\n return round(n, numDecimalPlaces).toFixed(numDecimalPlaces);\n}\n"],"mappings":"AAMO,SAASA,EAAM,EAAWC,EAAmB,EAAW,CAC7D,IAAMC,EAAY,KAAK,IAAI,GAAID,CAAgB,EAC/C,OAAO,KAAK,MAAM,EAAIC,CAAS,EAAIA,CACrC,CAMO,SAASC,EAAO,EAAWF,EAAmB,EAAW,CAC9D,OAAOD,EAAM,EAAGC,CAAgB,EAAE,QAAQA,CAAgB,CAC5D","names":["round","numDecimalPlaces","multipler","roundS"]}
package/round.mjs ADDED
@@ -0,0 +1,12 @@
1
+ // src/round.ts
2
+ function round(n, numDecimalPlaces = 0) {
3
+ const multipler = Math.pow(10, numDecimalPlaces);
4
+ return Math.round(n * multipler) / multipler;
5
+ }
6
+ function roundS(n, numDecimalPlaces = 0) {
7
+ return round(n, numDecimalPlaces).toFixed(numDecimalPlaces);
8
+ }
9
+ export {
10
+ round,
11
+ roundS
12
+ };
@@ -32,4 +32,3 @@ function safeBtoa(input) {
32
32
  0 && (module.exports = {
33
33
  safeBtoa
34
34
  });
35
- //# sourceMappingURL=safeBtoa.js.map
package/safeBtoa.d.mts ADDED
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Base 64 encode the given input string, but safely.
3
+ */
4
+ declare function safeBtoa(input: string): string;
5
+
6
+ export { safeBtoa };
package/safeBtoa.d.ts CHANGED
@@ -1,4 +1,6 @@
1
1
  /**
2
2
  * Base 64 encode the given input string, but safely.
3
3
  */
4
- export declare function safeBtoa(input: string): string;
4
+ declare function safeBtoa(input: string): string;
5
+
6
+ export { safeBtoa };
@@ -0,0 +1,2 @@
1
+ "use strict";var i=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var f=(t,n)=>{for(var o in n)i(t,o,{get:n[o],enumerable:!0})},g=(t,n,o,e)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of s(n))!c.call(t,r)&&r!==o&&i(t,r,{get:()=>n[r],enumerable:!(e=a(n,r))||e.enumerable});return t};var d=t=>g(i({},"__esModule",{value:!0}),t);var u={};f(u,{safeBtoa:()=>m});module.exports=d(u);function m(t){let n=new TextEncoder().encode(t),o=Array.from(n).map(e=>String.fromCodePoint(e)).join("");return btoa(o)}0&&(module.exports={safeBtoa});
2
+ //# sourceMappingURL=safeBtoa.min.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/safeBtoa.ts"],"sourcesContent":["/**\n * Base 64 encode the given input string, but safely.\n */\nexport function safeBtoa(input: string): string {\n // Convert the string to a UTF-8 encoded binary-safe string\n const utf8Bytes = new TextEncoder().encode(input);\n\n // Convert the binary data to a string for btoa\n const binaryString = Array.from(utf8Bytes)\n .map((byte) => String.fromCodePoint(byte))\n .join(\"\");\n\n // Use btoa to encode the binary-safe string\n return btoa(binaryString);\n}\n"],"mappings":"yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,cAAAE,IAAA,eAAAC,EAAAH,GAGO,SAASE,EAASE,EAAuB,CAE9C,IAAMC,EAAY,IAAI,YAAY,EAAE,OAAOD,CAAK,EAG1CE,EAAe,MAAM,KAAKD,CAAS,EACtC,IAAKE,GAAS,OAAO,cAAcA,CAAI,CAAC,EACxC,KAAK,EAAE,EAGV,OAAO,KAAKD,CAAY,CAC1B","names":["safeBtoa_exports","__export","safeBtoa","__toCommonJS","input","utf8Bytes","binaryString","byte"]}
@@ -0,0 +1,2 @@
1
+ function e(n){let t=new TextEncoder().encode(n),o=Array.from(t).map(r=>String.fromCodePoint(r)).join("");return btoa(o)}export{e as safeBtoa};
2
+ //# sourceMappingURL=safeBtoa.min.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/safeBtoa.ts"],"sourcesContent":["/**\n * Base 64 encode the given input string, but safely.\n */\nexport function safeBtoa(input: string): string {\n // Convert the string to a UTF-8 encoded binary-safe string\n const utf8Bytes = new TextEncoder().encode(input);\n\n // Convert the binary data to a string for btoa\n const binaryString = Array.from(utf8Bytes)\n .map((byte) => String.fromCodePoint(byte))\n .join(\"\");\n\n // Use btoa to encode the binary-safe string\n return btoa(binaryString);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGO,SAAS,SAAS,OAAuB;AAE9C,QAAM,YAAY,IAAI,YAAY,EAAE,OAAO,KAAK;AAGhD,QAAM,eAAe,MAAM,KAAK,SAAS,EACtC,IAAI,CAAC,SAAS,OAAO,cAAc,IAAI,CAAC,EACxC,KAAK,EAAE;AAGV,SAAO,KAAK,YAAY;AAC1B;","names":[]}
1
+ {"version":3,"sources":["../src/safeBtoa.ts"],"sourcesContent":["/**\n * Base 64 encode the given input string, but safely.\n */\nexport function safeBtoa(input: string): string {\n // Convert the string to a UTF-8 encoded binary-safe string\n const utf8Bytes = new TextEncoder().encode(input);\n\n // Convert the binary data to a string for btoa\n const binaryString = Array.from(utf8Bytes)\n .map((byte) => String.fromCodePoint(byte))\n .join(\"\");\n\n // Use btoa to encode the binary-safe string\n return btoa(binaryString);\n}\n"],"mappings":"AAGO,SAASA,EAASC,EAAuB,CAE9C,IAAMC,EAAY,IAAI,YAAY,EAAE,OAAOD,CAAK,EAG1CE,EAAe,MAAM,KAAKD,CAAS,EACtC,IAAKE,GAAS,OAAO,cAAcA,CAAI,CAAC,EACxC,KAAK,EAAE,EAGV,OAAO,KAAKD,CAAY,CAC1B","names":["safeBtoa","input","utf8Bytes","binaryString","byte"]}
package/safeBtoa.mjs ADDED
@@ -0,0 +1,9 @@
1
+ // src/safeBtoa.ts
2
+ function safeBtoa(input) {
3
+ const utf8Bytes = new TextEncoder().encode(input);
4
+ const binaryString = Array.from(utf8Bytes).map((byte) => String.fromCodePoint(byte)).join("");
5
+ return btoa(binaryString);
6
+ }
7
+ export {
8
+ safeBtoa
9
+ };
@@ -31,4 +31,3 @@ function safeParseFloat(s, defaultValue = 0) {
31
31
  0 && (module.exports = {
32
32
  safeParseFloat
33
33
  });
34
- //# sourceMappingURL=safeParseFloat.js.map
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Returns 0 or the given defaultValue if the string is not a valid number.
3
+ */
4
+ declare function safeParseFloat<T>(s: string, defaultValue?: T | number): T | number;
5
+
6
+ export { safeParseFloat };
@@ -1,4 +1,6 @@
1
1
  /**
2
2
  * Returns 0 or the given defaultValue if the string is not a valid number.
3
3
  */
4
- export declare function safeParseFloat<T>(s: string, defaultValue?: T | number): T | number;
4
+ declare function safeParseFloat<T>(s: string, defaultValue?: T | number): T | number;
5
+
6
+ export { safeParseFloat };
@@ -0,0 +1,2 @@
1
+ "use strict";var s=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var o=Object.prototype.hasOwnProperty;var b=(e,r)=>{for(var n in r)s(e,n,{get:r[n],enumerable:!0})},m=(e,r,n,u)=>{if(r&&typeof r=="object"||typeof r=="function")for(let t of i(r))!o.call(e,t)&&t!==n&&s(e,t,{get:()=>r[t],enumerable:!(u=a(r,t))||u.enumerable});return e};var N=e=>m(s({},"__esModule",{value:!0}),e);var c={};b(c,{safeParseFloat:()=>T});module.exports=N(c);function T(e,r=0){let n=Number(e);return isNaN(n)?r:n}0&&(module.exports={safeParseFloat});
2
+ //# sourceMappingURL=safeParseFloat.min.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/safeParseFloat.ts"],"sourcesContent":["/**\n * Returns 0 or the given defaultValue if the string is not a valid number.\n */\nexport function safeParseFloat<T>(\n s: string,\n defaultValue: T | number = 0,\n): T | number {\n const i = Number(s);\n return isNaN(i) ? defaultValue : i;\n}\n"],"mappings":"yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,oBAAAE,IAAA,eAAAC,EAAAH,GAGO,SAASE,EACdE,EACAC,EAA2B,EACf,CACZ,IAAMC,EAAI,OAAOF,CAAC,EAClB,OAAO,MAAME,CAAC,EAAID,EAAeC,CACnC","names":["safeParseFloat_exports","__export","safeParseFloat","__toCommonJS","s","defaultValue","i"]}
@@ -0,0 +1,2 @@
1
+ function t(e,n=0){let r=Number(e);return isNaN(r)?n:r}export{t as safeParseFloat};
2
+ //# sourceMappingURL=safeParseFloat.min.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/safeParseFloat.ts"],"sourcesContent":["/**\n * Returns 0 or the given defaultValue if the string is not a valid number.\n */\nexport function safeParseFloat<T>(\n s: string,\n defaultValue: T | number = 0,\n): T | number {\n const i = Number(s);\n return isNaN(i) ? defaultValue : i;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGO,SAAS,eACd,GACA,eAA2B,GACf;AACZ,QAAM,IAAI,OAAO,CAAC;AAClB,SAAO,MAAM,CAAC,IAAI,eAAe;AACnC;","names":[]}
1
+ {"version":3,"sources":["../src/safeParseFloat.ts"],"sourcesContent":["/**\n * Returns 0 or the given defaultValue if the string is not a valid number.\n */\nexport function safeParseFloat<T>(\n s: string,\n defaultValue: T | number = 0,\n): T | number {\n const i = Number(s);\n return isNaN(i) ? defaultValue : i;\n}\n"],"mappings":"AAGO,SAASA,EACdC,EACAC,EAA2B,EACf,CACZ,IAAMC,EAAI,OAAOF,CAAC,EAClB,OAAO,MAAME,CAAC,EAAID,EAAeC,CACnC","names":["safeParseFloat","s","defaultValue","i"]}
@@ -0,0 +1,8 @@
1
+ // src/safeParseFloat.ts
2
+ function safeParseFloat(s, defaultValue = 0) {
3
+ const i = Number(s);
4
+ return isNaN(i) ? defaultValue : i;
5
+ }
6
+ export {
7
+ safeParseFloat
8
+ };
@@ -31,4 +31,3 @@ function safeParseInt(s, defaultValue = 0) {
31
31
  0 && (module.exports = {
32
32
  safeParseInt
33
33
  });
34
- //# sourceMappingURL=safeParseInt.js.map
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Returns 0 or the given defaultValue if the string is not a valid number.
3
+ */
4
+ declare function safeParseInt<T>(s: string, defaultValue?: T | number): T | number;
5
+
6
+ export { safeParseInt };
package/safeParseInt.d.ts CHANGED
@@ -1,4 +1,6 @@
1
1
  /**
2
2
  * Returns 0 or the given defaultValue if the string is not a valid number.
3
3
  */
4
- export declare function safeParseInt<T>(s: string, defaultValue?: T | number): T | number;
4
+ declare function safeParseInt<T>(s: string, defaultValue?: T | number): T | number;
5
+
6
+ export { safeParseInt };
@@ -0,0 +1,2 @@
1
+ "use strict";var o=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var a=Object.getOwnPropertyNames;var i=Object.prototype.hasOwnProperty;var b=(n,r)=>{for(var e in r)o(n,e,{get:r[e],enumerable:!0})},f=(n,r,e,s)=>{if(r&&typeof r=="object"||typeof r=="function")for(let t of a(r))!i.call(n,t)&&t!==e&&o(n,t,{get:()=>r[t],enumerable:!(s=u(r,t))||s.enumerable});return n};var m=n=>f(o({},"__esModule",{value:!0}),n);var T={};b(T,{safeParseInt:()=>N});module.exports=m(T);function N(n,r=0){let e=Number(n);return isNaN(e)?r:Math.floor(e)}0&&(module.exports={safeParseInt});
2
+ //# sourceMappingURL=safeParseInt.min.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/safeParseInt.ts"],"sourcesContent":["/**\n * Returns 0 or the given defaultValue if the string is not a valid number.\n */\nexport function safeParseInt<T>(\n s: string,\n defaultValue: T | number = 0,\n): T | number {\n const i = Number(s);\n return isNaN(i) ? defaultValue : Math.floor(i);\n}\n"],"mappings":"yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,kBAAAE,IAAA,eAAAC,EAAAH,GAGO,SAASE,EACdE,EACAC,EAA2B,EACf,CACZ,IAAMC,EAAI,OAAOF,CAAC,EAClB,OAAO,MAAME,CAAC,EAAID,EAAe,KAAK,MAAMC,CAAC,CAC/C","names":["safeParseInt_exports","__export","safeParseInt","__toCommonJS","s","defaultValue","i"]}
@@ -0,0 +1,2 @@
1
+ function t(n,e=0){let r=Number(n);return isNaN(r)?e:Math.floor(r)}export{t as safeParseInt};
2
+ //# sourceMappingURL=safeParseInt.min.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/safeParseInt.ts"],"sourcesContent":["/**\n * Returns 0 or the given defaultValue if the string is not a valid number.\n */\nexport function safeParseInt<T>(\n s: string,\n defaultValue: T | number = 0,\n): T | number {\n const i = Number(s);\n return isNaN(i) ? defaultValue : Math.floor(i);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGO,SAAS,aACd,GACA,eAA2B,GACf;AACZ,QAAM,IAAI,OAAO,CAAC;AAClB,SAAO,MAAM,CAAC,IAAI,eAAe,KAAK,MAAM,CAAC;AAC/C;","names":[]}
1
+ {"version":3,"sources":["../src/safeParseInt.ts"],"sourcesContent":["/**\n * Returns 0 or the given defaultValue if the string is not a valid number.\n */\nexport function safeParseInt<T>(\n s: string,\n defaultValue: T | number = 0,\n): T | number {\n const i = Number(s);\n return isNaN(i) ? defaultValue : Math.floor(i);\n}\n"],"mappings":"AAGO,SAASA,EACdC,EACAC,EAA2B,EACf,CACZ,IAAMC,EAAI,OAAOF,CAAC,EAClB,OAAO,MAAME,CAAC,EAAID,EAAe,KAAK,MAAMC,CAAC,CAC/C","names":["safeParseInt","s","defaultValue","i"]}
@@ -0,0 +1,8 @@
1
+ // src/safeParseInt.ts
2
+ function safeParseInt(s, defaultValue = 0) {
3
+ const i = Number(s);
4
+ return isNaN(i) ? defaultValue : Math.floor(i);
5
+ }
6
+ export {
7
+ safeParseInt
8
+ };
package/sha256.cjs ADDED
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/sha256.ts
21
+ var sha256_exports = {};
22
+ __export(sha256_exports, {
23
+ sha256: () => sha256
24
+ });
25
+ module.exports = __toCommonJS(sha256_exports);
26
+ async function sha256(input) {
27
+ const encoder = new TextEncoder();
28
+ const uint8Array = encoder.encode(input);
29
+ const arrayBuffer = await crypto.subtle.digest("SHA-256", uint8Array);
30
+ return arrayBuffer;
31
+ }
32
+ // Annotate the CommonJS export names for ESM import in node:
33
+ 0 && (module.exports = {
34
+ sha256
35
+ });
package/sha256.d.mts ADDED
@@ -0,0 +1,6 @@
1
+ /**
2
+ * SHA-256 hash an input string into an ArrayBuffer.
3
+ */
4
+ declare function sha256(input: string): Promise<ArrayBuffer>;
5
+
6
+ export { sha256 };
package/sha256.d.ts CHANGED
@@ -1,4 +1,6 @@
1
1
  /**
2
2
  * SHA-256 hash an input string into an ArrayBuffer.
3
3
  */
4
- export declare function sha256(input: string): Promise<ArrayBuffer>;
4
+ declare function sha256(input: string): Promise<ArrayBuffer>;
5
+
6
+ export { sha256 };
package/sha256.min.cjs ADDED
@@ -0,0 +1,2 @@
1
+ "use strict";var a=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var f=Object.prototype.hasOwnProperty;var u=(e,r)=>{for(var n in r)a(e,n,{get:r[n],enumerable:!0})},i=(e,r,n,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let t of s(r))!f.call(e,t)&&t!==n&&a(e,t,{get:()=>r[t],enumerable:!(o=c(r,t))||o.enumerable});return e};var y=e=>i(a({},"__esModule",{value:!0}),e);var A={};u(A,{sha256:()=>d});module.exports=y(A);async function d(e){let n=new TextEncoder().encode(e);return await crypto.subtle.digest("SHA-256",n)}0&&(module.exports={sha256});
2
+ //# sourceMappingURL=sha256.min.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/sha256.ts"],"sourcesContent":["/**\n * SHA-256 hash an input string into an ArrayBuffer.\n */\nexport async function sha256(input: string): Promise<ArrayBuffer> {\n // Encode the input string as a Uint8Array\n const encoder = new TextEncoder();\n const uint8Array = encoder.encode(input);\n\n // Compute the SHA-256 hash using the SubtleCrypto API\n const arrayBuffer = await crypto.subtle.digest(\"SHA-256\", uint8Array);\n\n return arrayBuffer;\n}\n"],"mappings":"yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,YAAAE,IAAA,eAAAC,EAAAH,GAGA,eAAsBE,EAAOE,EAAqC,CAGhE,IAAMC,EADU,IAAI,YAAY,EACL,OAAOD,CAAK,EAKvC,OAFoB,MAAM,OAAO,OAAO,OAAO,UAAWC,CAAU,CAGtE","names":["sha256_exports","__export","sha256","__toCommonJS","input","uint8Array"]}
package/sha256.min.mjs ADDED
@@ -0,0 +1,2 @@
1
+ async function o(r){let e=new TextEncoder().encode(r);return await crypto.subtle.digest("SHA-256",e)}export{o as sha256};
2
+ //# sourceMappingURL=sha256.min.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/sha256.ts"],"sourcesContent":["/**\n * SHA-256 hash an input string into an ArrayBuffer.\n */\nexport async function sha256(input: string): Promise<ArrayBuffer> {\n // Encode the input string as a Uint8Array\n const encoder = new TextEncoder();\n const uint8Array = encoder.encode(input);\n\n // Compute the SHA-256 hash using the SubtleCrypto API\n const arrayBuffer = await crypto.subtle.digest(\"SHA-256\", uint8Array);\n\n return arrayBuffer;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,SAAsB,OAAO,OAAqC;AAAA;AAEhE,UAAM,UAAU,IAAI,YAAY;AAChC,UAAM,aAAa,QAAQ,OAAO,KAAK;AAGvC,UAAM,cAAc,MAAM,OAAO,OAAO,OAAO,WAAW,UAAU;AAEpE,WAAO;AAAA,EACT;AAAA;","names":[]}
1
+ {"version":3,"sources":["../src/sha256.ts"],"sourcesContent":["/**\n * SHA-256 hash an input string into an ArrayBuffer.\n */\nexport async function sha256(input: string): Promise<ArrayBuffer> {\n // Encode the input string as a Uint8Array\n const encoder = new TextEncoder();\n const uint8Array = encoder.encode(input);\n\n // Compute the SHA-256 hash using the SubtleCrypto API\n const arrayBuffer = await crypto.subtle.digest(\"SHA-256\", uint8Array);\n\n return arrayBuffer;\n}\n"],"mappings":"AAGA,eAAsBA,EAAOC,EAAqC,CAGhE,IAAMC,EADU,IAAI,YAAY,EACL,OAAOD,CAAK,EAKvC,OAFoB,MAAM,OAAO,OAAO,OAAO,UAAWC,CAAU,CAGtE","names":["sha256","input","uint8Array"]}
package/sha256.mjs ADDED
@@ -0,0 +1,10 @@
1
+ // src/sha256.ts
2
+ async function sha256(input) {
3
+ const encoder = new TextEncoder();
4
+ const uint8Array = encoder.encode(input);
5
+ const arrayBuffer = await crypto.subtle.digest("SHA-256", uint8Array);
6
+ return arrayBuffer;
7
+ }
8
+ export {
9
+ sha256
10
+ };
@@ -30,4 +30,3 @@ function sleep(ms) {
30
30
  0 && (module.exports = {
31
31
  sleep
32
32
  });
33
- //# sourceMappingURL=sleep.js.map
@@ -2,6 +2,6 @@
2
2
  * Sleep for a given number of milliseconds. Note that this method is async,
3
3
  * so please remember to call it with await, like `await sleep(1000);`.
4
4
  */
5
- export function sleep(ms: number): Promise<void> {
6
- return new Promise((resolve) => setTimeout(resolve, ms));
7
- }
5
+ declare function sleep(ms: number): Promise<void>;
6
+
7
+ export { sleep };
package/sleep.d.ts CHANGED
@@ -2,4 +2,6 @@
2
2
  * Sleep for a given number of milliseconds. Note that this method is async,
3
3
  * so please remember to call it with await, like `await sleep(1000);`.
4
4
  */
5
- export declare function sleep(ms: number): Promise<void>;
5
+ declare function sleep(ms: number): Promise<void>;
6
+
7
+ export { sleep };
package/sleep.min.cjs ADDED
@@ -0,0 +1,2 @@
1
+ "use strict";var n=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var p=(o,e)=>{for(var i in e)n(o,i,{get:e[i],enumerable:!0})},P=(o,e,i,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of s(e))!u.call(o,r)&&r!==i&&n(o,r,{get:()=>e[r],enumerable:!(t=m(e,r))||t.enumerable});return o};var b=o=>P(n({},"__esModule",{value:!0}),o);var d={};p(d,{sleep:()=>c});module.exports=b(d);function c(o){return new Promise(e=>setTimeout(e,o))}0&&(module.exports={sleep});
2
+ //# sourceMappingURL=sleep.min.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/sleep.ts"],"sourcesContent":["/**\n * Sleep for a given number of milliseconds. Note that this method is async,\n * so please remember to call it with await, like `await sleep(1000);`.\n */\nexport function sleep(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n"],"mappings":"yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,WAAAE,IAAA,eAAAC,EAAAH,GAIO,SAASE,EAAME,EAA2B,CAC/C,OAAO,IAAI,QAASC,GAAY,WAAWA,EAASD,CAAE,CAAC,CACzD","names":["sleep_exports","__export","sleep","__toCommonJS","ms","resolve"]}
package/sleep.min.mjs ADDED
@@ -0,0 +1,2 @@
1
+ function r(e){return new Promise(o=>setTimeout(o,e))}export{r as sleep};
2
+ //# sourceMappingURL=sleep.min.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/sleep.ts"],"sourcesContent":["/**\n * Sleep for a given number of milliseconds. Note that this method is async,\n * so please remember to call it with await, like `await sleep(1000);`.\n */\nexport function sleep(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIO,SAAS,MAAM,IAA2B;AAC/C,SAAO,IAAI,QAAQ,CAAC,YAAY,WAAW,SAAS,EAAE,CAAC;AACzD;","names":[]}
1
+ {"version":3,"sources":["../src/sleep.ts"],"sourcesContent":["/**\n * Sleep for a given number of milliseconds. Note that this method is async,\n * so please remember to call it with await, like `await sleep(1000);`.\n */\nexport function sleep(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n"],"mappings":"AAIO,SAASA,EAAMC,EAA2B,CAC/C,OAAO,IAAI,QAASC,GAAY,WAAWA,EAASD,CAAE,CAAC,CACzD","names":["sleep","ms","resolve"]}
package/sleep.mjs ADDED
@@ -0,0 +1,7 @@
1
+ // src/sleep.ts
2
+ function sleep(ms) {
3
+ return new Promise((resolve) => setTimeout(resolve, ms));
4
+ }
5
+ export {
6
+ sleep
7
+ };
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+
16
+ // src/storageAdapter.ts
17
+ var storageAdapter_exports = {};
18
+ module.exports = __toCommonJS(storageAdapter_exports);
@@ -0,0 +1,33 @@
1
+ import { Duration } from './duration.mjs';
2
+
3
+ /**
4
+ * Most basic interface for a storage implementation. This is designed to be
5
+ * quite easily implemented by users to plug in any new underlying storage.
6
+ */
7
+ type StorageAdapter<T> = {
8
+ set: (key: string, value: T) => Promise<void> | void;
9
+ get: (key: string) => Promise<T | undefined> | T | undefined;
10
+ delete: (key: string) => Promise<void> | void;
11
+ clear: () => Promise<void> | void;
12
+ };
13
+ /** Most basic interface for stored object. */
14
+ type StoredObject<T> = {
15
+ value: T;
16
+ storedMs: number;
17
+ expiryMs: number;
18
+ };
19
+ /**
20
+ * Full interface for a storage implementation. Each method can be either sync
21
+ * or async, and the interface works with either implementation scheme.
22
+ */
23
+ type FullStorageAdapter<T> = StorageAdapter<T> & {
24
+ set: (key: string, value: T, expiryDeltaMs?: number | Duration) => Promise<void> | void;
25
+ getStoredObject: (key: string) => Promise<StoredObject<T> | undefined> | StoredObject<T> | undefined;
26
+ forEach(callback: (key: string, value: T, expiryMs: number, storedMs: number) => void | Promise<void>): Promise<void> | void;
27
+ size(): Promise<number> | number;
28
+ asMap<T>(): Promise<Map<string, StoredObject<T>>> | Map<string, StoredObject<T>>;
29
+ gc: () => Promise<void> | void;
30
+ gcNow: () => Promise<void> | void;
31
+ };
32
+
33
+ export type { FullStorageAdapter, StorageAdapter, StoredObject };
@@ -0,0 +1,33 @@
1
+ import { Duration } from './duration.js';
2
+
3
+ /**
4
+ * Most basic interface for a storage implementation. This is designed to be
5
+ * quite easily implemented by users to plug in any new underlying storage.
6
+ */
7
+ type StorageAdapter<T> = {
8
+ set: (key: string, value: T) => Promise<void> | void;
9
+ get: (key: string) => Promise<T | undefined> | T | undefined;
10
+ delete: (key: string) => Promise<void> | void;
11
+ clear: () => Promise<void> | void;
12
+ };
13
+ /** Most basic interface for stored object. */
14
+ type StoredObject<T> = {
15
+ value: T;
16
+ storedMs: number;
17
+ expiryMs: number;
18
+ };
19
+ /**
20
+ * Full interface for a storage implementation. Each method can be either sync
21
+ * or async, and the interface works with either implementation scheme.
22
+ */
23
+ type FullStorageAdapter<T> = StorageAdapter<T> & {
24
+ set: (key: string, value: T, expiryDeltaMs?: number | Duration) => Promise<void> | void;
25
+ getStoredObject: (key: string) => Promise<StoredObject<T> | undefined> | StoredObject<T> | undefined;
26
+ forEach(callback: (key: string, value: T, expiryMs: number, storedMs: number) => void | Promise<void>): Promise<void> | void;
27
+ size(): Promise<number> | number;
28
+ asMap<T>(): Promise<Map<string, StoredObject<T>>> | Map<string, StoredObject<T>>;
29
+ gc: () => Promise<void> | void;
30
+ gcNow: () => Promise<void> | void;
31
+ };
32
+
33
+ export type { FullStorageAdapter, StorageAdapter, StoredObject };
@@ -0,0 +1,2 @@
1
+ "use strict";var t=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var n=Object.getOwnPropertyNames;var a=Object.prototype.hasOwnProperty;var m=(r,e,d,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of n(e))!a.call(r,o)&&o!==d&&t(r,o,{get:()=>e[o],enumerable:!(i=s(e,o))||i.enumerable});return r};var v=r=>m(t({},"__esModule",{value:!0}),r);var u={};module.exports=v(u);
2
+ //# sourceMappingURL=storageAdapter.min.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/storageAdapter.ts"],"sourcesContent":["import { Duration } from \"./duration\";\n\n/**\n * Most basic interface for a storage implementation. This is designed to be\n * quite easily implemented by users to plug in any new underlying storage.\n */\nexport type StorageAdapter<T> = {\n set: (key: string, value: T) => Promise<void> | void;\n get: (key: string) => Promise<T | undefined> | T | undefined;\n delete: (key: string) => Promise<void> | void;\n clear: () => Promise<void> | void;\n};\n\n/** Most basic interface for stored object. */\nexport type StoredObject<T> = {\n value: T;\n storedMs: number;\n expiryMs: number;\n};\n\n/**\n * Full interface for a storage implementation. Each method can be either sync\n * or async, and the interface works with either implementation scheme.\n */\nexport type FullStorageAdapter<T> = StorageAdapter<T> & {\n // Redefining `set()`, but with an optional expiration parameter.\n set: (\n key: string,\n value: T,\n expiryDeltaMs?: number | Duration,\n ) => Promise<void> | void;\n\n getStoredObject: (\n key: string,\n ) => Promise<StoredObject<T> | undefined> | StoredObject<T> | undefined;\n\n forEach(\n callback: (\n key: string,\n value: T,\n expiryMs: number,\n storedMs: number,\n ) => void | Promise<void>,\n ): Promise<void> | void;\n\n size(): Promise<number> | number;\n\n asMap<T>():\n | Promise<Map<string, StoredObject<T>>>\n | Map<string, StoredObject<T>>;\n\n gc: () => Promise<void> | void;\n\n gcNow: () => Promise<void> | void;\n};\n"],"mappings":"+WAAA,IAAAA,EAAA,kBAAAC,EAAAD","names":["storageAdapter_exports","__toCommonJS"]}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=storageAdapter.min.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
File without changes
@@ -36,4 +36,3 @@ function sum(numbers) {
36
36
  0 && (module.exports = {
37
37
  sum
38
38
  });
39
- //# sourceMappingURL=sum.js.map
package/sum.d.mts ADDED
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Add all the numbers together in the given array. Treats null, undefined and
3
+ * NaN as zero.
4
+ */
5
+ declare function sum(numbers: (number | null | undefined)[]): number;
6
+
7
+ export { sum };
package/sum.d.ts CHANGED
@@ -2,4 +2,6 @@
2
2
  * Add all the numbers together in the given array. Treats null, undefined and
3
3
  * NaN as zero.
4
4
  */
5
- export declare function sum(numbers: (number | null | undefined)[]): number;
5
+ declare function sum(numbers: (number | null | undefined)[]): number;
6
+
7
+ export { sum };
package/sum.min.cjs ADDED
@@ -0,0 +1,2 @@
1
+ "use strict";var b=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var r=Object.prototype.hasOwnProperty;var f=(n,e)=>{for(var u in e)b(n,u,{get:e[u],enumerable:!0})},o=(n,e,u,m)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of l(e))!r.call(n,i)&&i!==u&&b(n,i,{get:()=>e[i],enumerable:!(m=d(e,i))||m.enumerable});return n};var s=n=>o(b({},"__esModule",{value:!0}),n);var a={};f(a,{sum:()=>t});module.exports=s(a);function t(n){return n.reduce((e,u)=>{let m=typeof u=="number"&&!isNaN(u)&&isFinite(u)?u:0;return e+m},0)}0&&(module.exports={sum});
2
+ //# sourceMappingURL=sum.min.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/sum.ts"],"sourcesContent":["/**\n * Add all the numbers together in the given array. Treats null, undefined and\n * NaN as zero.\n */\nexport function sum(numbers: (number | null | undefined)[]): number {\n return numbers.reduce(\n (accumulated: number, current: number | null | undefined) => {\n const value =\n typeof current === \"number\" && !isNaN(current) && isFinite(current)\n ? current\n : 0;\n\n return accumulated + value;\n },\n 0,\n );\n}\n"],"mappings":"yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,SAAAE,IAAA,eAAAC,EAAAH,GAIO,SAASE,EAAIE,EAAgD,CAClE,OAAOA,EAAQ,OACb,CAACC,EAAqBC,IAAuC,CAC3D,IAAMC,EACJ,OAAOD,GAAY,UAAY,CAAC,MAAMA,CAAO,GAAK,SAASA,CAAO,EAC9DA,EACA,EAEN,OAAOD,EAAcE,CACvB,EACA,CACF,CACF","names":["sum_exports","__export","sum","__toCommonJS","numbers","accumulated","current","value"]}
package/sum.min.mjs ADDED
@@ -0,0 +1,2 @@
1
+ function m(n){return n.reduce((u,e)=>{let i=typeof e=="number"&&!isNaN(e)&&isFinite(e)?e:0;return u+i},0)}export{m as sum};
2
+ //# sourceMappingURL=sum.min.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/sum.ts"],"sourcesContent":["/**\n * Add all the numbers together in the given array. Treats null, undefined and\n * NaN as zero.\n */\nexport function sum(numbers: (number | null | undefined)[]): number {\n return numbers.reduce(\n (accumulated: number, current: number | null | undefined) => {\n const value =\n typeof current === \"number\" && !isNaN(current) && isFinite(current)\n ? current\n : 0;\n\n return accumulated + value;\n },\n 0,\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIO,SAAS,IAAI,SAAgD;AAClE,SAAO,QAAQ;AAAA,IACb,CAAC,aAAqB,YAAuC;AAC3D,YAAM,QACJ,OAAO,YAAY,YAAY,CAAC,MAAM,OAAO,KAAK,SAAS,OAAO,IAC9D,UACA;AAEN,aAAO,cAAc;AAAA,IACvB;AAAA,IACA;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/sum.ts"],"sourcesContent":["/**\n * Add all the numbers together in the given array. Treats null, undefined and\n * NaN as zero.\n */\nexport function sum(numbers: (number | null | undefined)[]): number {\n return numbers.reduce(\n (accumulated: number, current: number | null | undefined) => {\n const value =\n typeof current === \"number\" && !isNaN(current) && isFinite(current)\n ? current\n : 0;\n\n return accumulated + value;\n },\n 0,\n );\n}\n"],"mappings":"AAIO,SAASA,EAAIC,EAAgD,CAClE,OAAOA,EAAQ,OACb,CAACC,EAAqBC,IAAuC,CAC3D,IAAMC,EACJ,OAAOD,GAAY,UAAY,CAAC,MAAMA,CAAO,GAAK,SAASA,CAAO,EAC9DA,EACA,EAEN,OAAOD,EAAcE,CACvB,EACA,CACF,CACF","names":["sum","numbers","accumulated","current","value"]}
package/sum.mjs ADDED
@@ -0,0 +1,13 @@
1
+ // src/sum.ts
2
+ function sum(numbers) {
3
+ return numbers.reduce(
4
+ (accumulated, current) => {
5
+ const value = typeof current === "number" && !isNaN(current) && isFinite(current) ? current : 0;
6
+ return accumulated + value;
7
+ },
8
+ 0
9
+ );
10
+ }
11
+ export {
12
+ sum
13
+ };
@@ -67,4 +67,3 @@ var HOURS_PER_WEEK = 168;
67
67
  SECONDS_PER_MINUTE,
68
68
  SECONDS_PER_WEEK
69
69
  });
70
- //# sourceMappingURL=timeConstants.js.map
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Note that month and year do not have fixed durations, and hence are excluded
3
+ * from this file.
4
+ */
5
+ declare const MS_PER_SECOND = 1000;
6
+ declare const MS_PER_MINUTE = 60000;
7
+ declare const MS_PER_HOUR = 3600000;
8
+ declare const MS_PER_DAY = 86400000;
9
+ declare const MS_PER_WEEK = 604800000;
10
+ declare const SECONDS_PER_MINUTE = 60;
11
+ declare const SECONDS_PER_HOUR = 3600;
12
+ declare const SECONDS_PER_DAY = 86400;
13
+ declare const SECONDS_PER_WEEK = 604800;
14
+ declare const MINUTES_PER_HOUR = 60;
15
+ declare const MINUTES_PER_DAY = 1440;
16
+ declare const MINUTES_PER_WEEK = 10080;
17
+ declare const HOURS_PER_DAY = 24;
18
+ declare const HOURS_PER_WEEK = 168;
19
+
20
+ export { HOURS_PER_DAY, HOURS_PER_WEEK, MINUTES_PER_DAY, MINUTES_PER_HOUR, MINUTES_PER_WEEK, MS_PER_DAY, MS_PER_HOUR, MS_PER_MINUTE, MS_PER_SECOND, MS_PER_WEEK, SECONDS_PER_DAY, SECONDS_PER_HOUR, SECONDS_PER_MINUTE, SECONDS_PER_WEEK };