@ezez/utils 3.0.0 → 4.1.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 (468) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/dist/cap.js.map +1 -1
  3. package/dist/coalesce.d.ts.map +1 -1
  4. package/dist/coalesce.js.map +1 -1
  5. package/dist/compareArrays.d.ts.map +1 -1
  6. package/dist/compareProps.d.ts.map +1 -1
  7. package/dist/compareProps.js.map +1 -1
  8. package/dist/deserialize.d.ts.map +1 -1
  9. package/dist/deserialize.js.map +1 -1
  10. package/dist/ensureArray.d.ts.map +1 -1
  11. package/dist/ensureArray.js.map +1 -1
  12. package/dist/ensureDate.js.map +1 -1
  13. package/dist/ensureError.js.map +1 -1
  14. package/dist/ensurePrefix.js.map +1 -1
  15. package/dist/ensureSuffix.js.map +1 -1
  16. package/dist/ensureTimestamp.js.map +1 -1
  17. package/dist/escapeRegExp.d.ts.map +1 -1
  18. package/dist/escapeRegExp.js +1 -1
  19. package/dist/escapeRegExp.js.map +1 -1
  20. package/dist/formatDate.js +1 -1
  21. package/dist/formatDate.js.map +1 -1
  22. package/dist/get.js.map +1 -1
  23. package/dist/getMultiple.d.ts.map +1 -1
  24. package/dist/getMultiple.js.map +1 -1
  25. package/dist/index.d.ts +4 -0
  26. package/dist/index.d.ts.map +1 -1
  27. package/dist/index.js +4 -0
  28. package/dist/index.js.map +1 -1
  29. package/dist/insertSeparator.d.ts.map +1 -1
  30. package/dist/insertSeparator.js.map +1 -1
  31. package/dist/isEmpty.js.map +1 -1
  32. package/dist/isNumericString.js +1 -1
  33. package/dist/isNumericString.js.map +1 -1
  34. package/dist/last.d.ts.map +1 -1
  35. package/dist/later.d.ts.map +1 -1
  36. package/dist/mapAsync.d.ts.map +1 -1
  37. package/dist/mapAsync.js.map +1 -1
  38. package/dist/mapValues.d.ts.map +1 -1
  39. package/dist/mapValues.js.map +1 -1
  40. package/dist/match.d.ts.map +1 -1
  41. package/dist/match.js.map +1 -1
  42. package/dist/memoize.d.ts +3 -0
  43. package/dist/memoize.d.ts.map +1 -0
  44. package/dist/memoize.js +19 -0
  45. package/dist/memoize.js.map +1 -0
  46. package/dist/merge.d.ts +11 -7
  47. package/dist/merge.d.ts.map +1 -1
  48. package/dist/merge.js.map +1 -1
  49. package/dist/mostFrequent.d.ts.map +1 -1
  50. package/dist/mostFrequent.js.map +1 -1
  51. package/dist/occurrences.js.map +1 -1
  52. package/dist/omit.d.ts +1 -1
  53. package/dist/omit.d.ts.map +1 -1
  54. package/dist/omit.js.map +1 -1
  55. package/dist/pick.d.ts.map +1 -1
  56. package/dist/pick.js.map +1 -1
  57. package/dist/pull.d.ts.map +1 -1
  58. package/dist/pull.js.map +1 -1
  59. package/dist/remove.d.ts.map +1 -1
  60. package/dist/remove.js +1 -1
  61. package/dist/remove.js.map +1 -1
  62. package/dist/removeCommonProperties.d.ts.map +1 -1
  63. package/dist/removeCommonProperties.js +3 -1
  64. package/dist/removeCommonProperties.js.map +1 -1
  65. package/dist/replace.js +1 -1
  66. package/dist/replace.js.map +1 -1
  67. package/dist/replaceDeep.d.ts +5 -1
  68. package/dist/replaceDeep.d.ts.map +1 -1
  69. package/dist/replaceDeep.js +3 -20
  70. package/dist/replaceDeep.js.map +1 -1
  71. package/dist/replaceDeepByFn.d.ts +7 -0
  72. package/dist/replaceDeepByFn.d.ts.map +1 -0
  73. package/dist/replaceDeepByFn.js +47 -0
  74. package/dist/replaceDeepByFn.js.map +1 -0
  75. package/dist/safe.js.map +1 -1
  76. package/dist/sample.d.ts +3 -1
  77. package/dist/sample.d.ts.map +1 -1
  78. package/dist/sample.js.map +1 -1
  79. package/dist/samples.d.ts.map +1 -1
  80. package/dist/samples.js.map +1 -1
  81. package/dist/seq.d.ts.map +1 -1
  82. package/dist/seq.js +1 -1
  83. package/dist/seq.js.map +1 -1
  84. package/dist/serialize.d.ts.map +1 -1
  85. package/dist/serialize.js +56 -18
  86. package/dist/serialize.js.map +1 -1
  87. package/dist/set.js.map +1 -1
  88. package/dist/setImmutable.js.map +1 -1
  89. package/dist/shuffle.d.ts.map +1 -1
  90. package/dist/sortBy.d.ts.map +1 -1
  91. package/dist/sortBy.js.map +1 -1
  92. package/dist/sortProps.d.ts.map +1 -1
  93. package/dist/sortProps.js.map +1 -1
  94. package/dist/stripPrefix.js.map +1 -1
  95. package/dist/stripSuffix.js.map +1 -1
  96. package/dist/throttle.d.ts.map +1 -1
  97. package/dist/throttle.js.map +1 -1
  98. package/dist/toggle.d.ts.map +1 -1
  99. package/dist/toggle.js.map +1 -1
  100. package/dist/trim.d.ts +3 -0
  101. package/dist/trim.d.ts.map +1 -0
  102. package/dist/trim.js +10 -0
  103. package/dist/trim.js.map +1 -0
  104. package/dist/trimEnd.d.ts +3 -0
  105. package/dist/trimEnd.d.ts.map +1 -0
  106. package/dist/trimEnd.js +12 -0
  107. package/dist/trimEnd.js.map +1 -0
  108. package/dist/trimStart.d.ts +3 -0
  109. package/dist/trimStart.d.ts.map +1 -0
  110. package/dist/trimStart.js +12 -0
  111. package/dist/trimStart.js.map +1 -0
  112. package/dist/truthy.d.ts +1 -1
  113. package/dist/truthy.d.ts.map +1 -1
  114. package/dist/unique.d.ts.map +1 -1
  115. package/dist/utils/utils.d.ts +6 -0
  116. package/dist/utils/utils.d.ts.map +1 -0
  117. package/dist/utils/utils.js +10 -0
  118. package/dist/utils/utils.js.map +1 -0
  119. package/dist/waitFor.d.ts.map +1 -1
  120. package/dist/waitFor.js +1 -1
  121. package/dist/waitFor.js.map +1 -1
  122. package/dist/waitSync.js.map +1 -1
  123. package/docs/assets/icons.js +15 -0
  124. package/docs/assets/icons.svg +1 -0
  125. package/docs/assets/main.js +4 -3
  126. package/docs/assets/navigation.js +1 -0
  127. package/docs/assets/search.js +1 -1
  128. package/docs/assets/style.css +544 -394
  129. package/docs/documents/CHANGELOG.html +337 -0
  130. package/docs/functions/index.cap.html +5 -0
  131. package/docs/functions/index.capitalize.html +13 -0
  132. package/docs/functions/index.coalesce.html +16 -0
  133. package/docs/functions/index.compareArrays.html +8 -0
  134. package/docs/functions/index.compareProps.html +11 -0
  135. package/docs/functions/index.deserialize.html +6 -0
  136. package/docs/functions/index.ensureArray.html +3 -0
  137. package/docs/functions/index.ensureDate.html +10 -0
  138. package/docs/functions/index.ensureError.html +14 -0
  139. package/docs/functions/index.ensurePrefix.html +10 -0
  140. package/docs/functions/index.ensureSuffix.html +10 -0
  141. package/docs/functions/index.ensureTimestamp.html +10 -0
  142. package/docs/functions/index.escapeRegExp.html +7 -0
  143. package/docs/functions/index.formatDate.html +6 -0
  144. package/docs/functions/index.get.html +26 -0
  145. package/docs/functions/index.getMultiple.html +16 -0
  146. package/docs/functions/index.insertSeparator.html +7 -0
  147. package/docs/functions/index.isEmpty.html +33 -0
  148. package/docs/functions/index.isNumericString.html +5 -0
  149. package/docs/functions/index.isPlainObject.html +18 -0
  150. package/docs/functions/index.last.html +15 -0
  151. package/docs/functions/index.later-1.html +6 -0
  152. package/docs/functions/index.mapAsync.html +8 -0
  153. package/docs/functions/index.mapValues.html +14 -0
  154. package/docs/functions/index.match.html +4 -0
  155. package/docs/functions/index.memoize.html +8 -0
  156. package/docs/functions/index.merge.html +13 -0
  157. package/docs/functions/index.mostFrequent.html +2 -0
  158. package/docs/functions/index.noop.html +2 -0
  159. package/docs/functions/index.occurrences.html +14 -0
  160. package/docs/functions/index.omit.html +18 -0
  161. package/docs/functions/index.pick.html +13 -0
  162. package/docs/functions/index.pull.html +2 -0
  163. package/docs/functions/index.remove.html +2 -0
  164. package/docs/functions/index.removeCommonProperties.html +18 -0
  165. package/docs/functions/index.replace.html +10 -0
  166. package/docs/functions/index.replaceDeep.html +15 -0
  167. package/docs/functions/index.rethrow.html +2 -0
  168. package/docs/functions/index.round.html +7 -0
  169. package/docs/functions/index.safe.html +7 -0
  170. package/docs/functions/index.sample.html +6 -0
  171. package/docs/functions/index.samples.html +7 -0
  172. package/docs/functions/index.scale.html +5 -0
  173. package/docs/functions/index.seq.html +17 -0
  174. package/docs/functions/index.seqEarlyBreak.html +12 -0
  175. package/docs/functions/index.serialize.html +14 -0
  176. package/docs/functions/index.set.html +26 -0
  177. package/docs/functions/index.setImmutable.html +25 -0
  178. package/docs/functions/index.shuffle.html +3 -0
  179. package/docs/functions/index.sortBy.html +6 -0
  180. package/docs/functions/index.sortProps.html +10 -0
  181. package/docs/functions/index.stripPrefix.html +4 -0
  182. package/docs/functions/index.stripSuffix.html +4 -0
  183. package/docs/functions/index.throttle.html +14 -0
  184. package/docs/functions/index.toggle.html +5 -0
  185. package/docs/functions/index.trim.html +8 -0
  186. package/docs/functions/index.trimEnd.html +8 -0
  187. package/docs/functions/index.trimStart.html +8 -0
  188. package/docs/functions/index.truthy.html +7 -0
  189. package/docs/functions/index.unique.html +6 -0
  190. package/docs/functions/index.wait.html +3 -0
  191. package/docs/functions/index.waitFor.html +10 -0
  192. package/docs/functions/index.waitSync.html +3 -0
  193. package/docs/index.html +18 -204
  194. package/docs/interfaces/index.ComparePropsOptions.html +5 -0
  195. package/docs/interfaces/index.GetMultipleSource.html +3 -0
  196. package/docs/interfaces/index.GetSource.html +3 -0
  197. package/docs/interfaces/index.IsNumericStringOptions.html +5 -0
  198. package/docs/interfaces/index.OccurencesOptions.html +3 -0
  199. package/docs/interfaces/index.SetImmutableSource.html +3 -0
  200. package/docs/interfaces/index.SetSource.html +3 -0
  201. package/docs/interfaces/index.ThrottleOptions.html +5 -0
  202. package/docs/interfaces/index.ThrottledFunctionExtras.html +5 -0
  203. package/docs/modules/index.html +86 -0
  204. package/docs/types/index.CustomDeserializers.html +1 -0
  205. package/docs/types/index.CustomSerializers.html +1 -0
  206. package/docs/types/index.Later.html +4 -0
  207. package/docs/types/index.MapValuesFn.html +14 -0
  208. package/docs/types/index.MatchCallback.html +1 -0
  209. package/docs/types/index.MergeTwo.html +3 -0
  210. package/docs/types/index.SeqEarlyBreaker.html +4 -0
  211. package/docs/types/index.SeqFn.html +3 -0
  212. package/docs/types/index.SeqFunctions.html +4 -0
  213. package/docs/types/index.SetImmutablePath.html +4 -0
  214. package/docs/types/index.ThrottledFunction.html +1 -0
  215. package/docs/variables/index.mapValuesUNSET.html +2 -0
  216. package/docs/variables/index.mergeUNSET.html +4 -0
  217. package/esm/cap.js.map +1 -1
  218. package/esm/coalesce.d.ts.map +1 -1
  219. package/esm/coalesce.js.map +1 -1
  220. package/esm/compareArrays.d.ts.map +1 -1
  221. package/esm/compareProps.d.ts.map +1 -1
  222. package/esm/compareProps.js.map +1 -1
  223. package/esm/deserialize.d.ts.map +1 -1
  224. package/esm/deserialize.js.map +1 -1
  225. package/esm/ensureArray.d.ts.map +1 -1
  226. package/esm/ensureArray.js.map +1 -1
  227. package/esm/ensureDate.js.map +1 -1
  228. package/esm/ensureError.js.map +1 -1
  229. package/esm/ensurePrefix.js.map +1 -1
  230. package/esm/ensureSuffix.js.map +1 -1
  231. package/esm/ensureTimestamp.js.map +1 -1
  232. package/esm/escapeRegExp.d.ts.map +1 -1
  233. package/esm/escapeRegExp.js +1 -1
  234. package/esm/escapeRegExp.js.map +1 -1
  235. package/esm/formatDate.js +1 -1
  236. package/esm/formatDate.js.map +1 -1
  237. package/esm/get.js.map +1 -1
  238. package/esm/getMultiple.d.ts.map +1 -1
  239. package/esm/getMultiple.js.map +1 -1
  240. package/esm/index.d.ts +4 -0
  241. package/esm/index.d.ts.map +1 -1
  242. package/esm/index.js +4 -0
  243. package/esm/index.js.map +1 -1
  244. package/esm/insertSeparator.d.ts.map +1 -1
  245. package/esm/insertSeparator.js.map +1 -1
  246. package/esm/isEmpty.js.map +1 -1
  247. package/esm/isNumericString.js +1 -1
  248. package/esm/isNumericString.js.map +1 -1
  249. package/esm/last.d.ts.map +1 -1
  250. package/esm/later.d.ts.map +1 -1
  251. package/esm/mapAsync.d.ts.map +1 -1
  252. package/esm/mapAsync.js.map +1 -1
  253. package/esm/mapValues.d.ts.map +1 -1
  254. package/esm/mapValues.js.map +1 -1
  255. package/esm/match.d.ts.map +1 -1
  256. package/esm/match.js.map +1 -1
  257. package/esm/memoize.d.ts +3 -0
  258. package/esm/memoize.d.ts.map +1 -0
  259. package/esm/memoize.js +16 -0
  260. package/esm/memoize.js.map +1 -0
  261. package/esm/merge.d.ts +11 -7
  262. package/esm/merge.d.ts.map +1 -1
  263. package/esm/merge.js.map +1 -1
  264. package/esm/mostFrequent.d.ts.map +1 -1
  265. package/esm/mostFrequent.js.map +1 -1
  266. package/esm/occurrences.js.map +1 -1
  267. package/esm/omit.d.ts +1 -1
  268. package/esm/omit.d.ts.map +1 -1
  269. package/esm/omit.js.map +1 -1
  270. package/esm/pick.d.ts.map +1 -1
  271. package/esm/pick.js.map +1 -1
  272. package/esm/pull.d.ts.map +1 -1
  273. package/esm/pull.js.map +1 -1
  274. package/esm/remove.d.ts.map +1 -1
  275. package/esm/remove.js +1 -1
  276. package/esm/remove.js.map +1 -1
  277. package/esm/removeCommonProperties.d.ts.map +1 -1
  278. package/esm/removeCommonProperties.js +3 -1
  279. package/esm/removeCommonProperties.js.map +1 -1
  280. package/esm/replace.js +1 -1
  281. package/esm/replace.js.map +1 -1
  282. package/esm/replaceDeep.d.ts +5 -1
  283. package/esm/replaceDeep.d.ts.map +1 -1
  284. package/esm/replaceDeep.js +3 -20
  285. package/esm/replaceDeep.js.map +1 -1
  286. package/esm/replaceDeepByFn.d.ts +7 -0
  287. package/esm/replaceDeepByFn.d.ts.map +1 -0
  288. package/esm/replaceDeepByFn.js +44 -0
  289. package/esm/replaceDeepByFn.js.map +1 -0
  290. package/esm/safe.js.map +1 -1
  291. package/esm/sample.d.ts +3 -1
  292. package/esm/sample.d.ts.map +1 -1
  293. package/esm/sample.js.map +1 -1
  294. package/esm/samples.d.ts.map +1 -1
  295. package/esm/samples.js.map +1 -1
  296. package/esm/seq.d.ts.map +1 -1
  297. package/esm/seq.js +1 -1
  298. package/esm/seq.js.map +1 -1
  299. package/esm/serialize.d.ts.map +1 -1
  300. package/esm/serialize.js +56 -18
  301. package/esm/serialize.js.map +1 -1
  302. package/esm/set.js.map +1 -1
  303. package/esm/setImmutable.js.map +1 -1
  304. package/esm/shuffle.d.ts.map +1 -1
  305. package/esm/sortBy.d.ts.map +1 -1
  306. package/esm/sortBy.js.map +1 -1
  307. package/esm/sortProps.d.ts.map +1 -1
  308. package/esm/sortProps.js.map +1 -1
  309. package/esm/stripPrefix.js.map +1 -1
  310. package/esm/stripSuffix.js.map +1 -1
  311. package/esm/throttle.d.ts.map +1 -1
  312. package/esm/throttle.js.map +1 -1
  313. package/esm/toggle.d.ts.map +1 -1
  314. package/esm/toggle.js.map +1 -1
  315. package/esm/trim.d.ts +3 -0
  316. package/esm/trim.d.ts.map +1 -0
  317. package/esm/trim.js +7 -0
  318. package/esm/trim.js.map +1 -0
  319. package/esm/trimEnd.d.ts +3 -0
  320. package/esm/trimEnd.d.ts.map +1 -0
  321. package/esm/trimEnd.js +9 -0
  322. package/esm/trimEnd.js.map +1 -0
  323. package/esm/trimStart.d.ts +3 -0
  324. package/esm/trimStart.d.ts.map +1 -0
  325. package/esm/trimStart.js +9 -0
  326. package/esm/trimStart.js.map +1 -0
  327. package/esm/truthy.d.ts +1 -1
  328. package/esm/truthy.d.ts.map +1 -1
  329. package/esm/unique.d.ts.map +1 -1
  330. package/esm/utils/utils.d.ts +6 -0
  331. package/esm/utils/utils.d.ts.map +1 -0
  332. package/esm/utils/utils.js +7 -0
  333. package/esm/utils/utils.js.map +1 -0
  334. package/esm/waitFor.d.ts.map +1 -1
  335. package/esm/waitFor.js +1 -1
  336. package/esm/waitFor.js.map +1 -1
  337. package/esm/waitSync.js.map +1 -1
  338. package/package.json +10 -17
  339. package/pnpm-lock.yaml +661 -386
  340. package/src/compareProps.ts +9 -2
  341. package/src/deserialize.spec.ts +13 -0
  342. package/src/escapeRegExp.spec.ts +5 -3
  343. package/src/escapeRegExp.ts +3 -2
  344. package/src/formatDate.ts +2 -2
  345. package/src/get.spec.ts +1 -0
  346. package/src/getMultiple.ts +1 -0
  347. package/src/index.ts +4 -0
  348. package/src/isNumericString.ts +3 -3
  349. package/src/memoize.spec.ts +90 -0
  350. package/src/memoize.ts +35 -0
  351. package/src/merge.ts +30 -8
  352. package/src/mostFrequent.ts +1 -0
  353. package/src/omit.ts +8 -2
  354. package/src/pick.ts +1 -1
  355. package/src/remove.ts +1 -1
  356. package/src/removeCommonProperties.ts +4 -2
  357. package/src/replace.ts +1 -1
  358. package/src/replaceDeep.spec.ts +91 -0
  359. package/src/replaceDeep.ts +22 -27
  360. package/src/replaceDeepByFn.spec.ts +162 -0
  361. package/src/replaceDeepByFn.ts +93 -0
  362. package/src/rethrow.ts +1 -1
  363. package/src/sample.spec.ts +1 -0
  364. package/src/sample.ts +18 -2
  365. package/src/samples.ts +1 -1
  366. package/src/seq.spec.ts +6 -3
  367. package/src/seq.ts +1 -1
  368. package/src/serialize.spec.ts +43 -0
  369. package/src/serialize.ts +66 -19
  370. package/src/set.ts +1 -1
  371. package/src/setImmutable.ts +1 -1
  372. package/src/sortBy.ts +1 -1
  373. package/src/throttle.ts +1 -1
  374. package/src/trim.spec.ts +22 -0
  375. package/src/trim.ts +23 -0
  376. package/src/trimEnd.spec.ts +20 -0
  377. package/src/trimEnd.ts +22 -0
  378. package/src/trimStart.spec.ts +20 -0
  379. package/src/trimStart.ts +22 -0
  380. package/src/utils/utils.ts +11 -0
  381. package/src/waitFor.spec.ts +7 -2
  382. package/src/waitFor.ts +1 -1
  383. package/typedoc.cjs +2 -4
  384. package/docs/assets/pages.css +0 -14
  385. package/docs/functions/cap.html +0 -149
  386. package/docs/functions/capitalize.html +0 -154
  387. package/docs/functions/coalesce.html +0 -159
  388. package/docs/functions/compareArrays.html +0 -162
  389. package/docs/functions/compareProps.html +0 -161
  390. package/docs/functions/deserialize.html +0 -153
  391. package/docs/functions/ensureArray.html +0 -147
  392. package/docs/functions/ensureDate.html +0 -149
  393. package/docs/functions/ensureError.html +0 -153
  394. package/docs/functions/ensurePrefix.html +0 -151
  395. package/docs/functions/ensureSuffix.html +0 -151
  396. package/docs/functions/ensureTimestamp.html +0 -149
  397. package/docs/functions/escapeRegExp.html +0 -145
  398. package/docs/functions/formatDate.html +0 -147
  399. package/docs/functions/get.html +0 -171
  400. package/docs/functions/getMultiple.html +0 -162
  401. package/docs/functions/insertSeparator.html +0 -156
  402. package/docs/functions/isEmpty.html +0 -172
  403. package/docs/functions/isNumericString.html +0 -146
  404. package/docs/functions/isPlainObject.html +0 -156
  405. package/docs/functions/last.html +0 -159
  406. package/docs/functions/later-1.html +0 -144
  407. package/docs/functions/mapAsync.html +0 -177
  408. package/docs/functions/mapValues.html +0 -163
  409. package/docs/functions/match.html +0 -155
  410. package/docs/functions/merge.html +0 -497
  411. package/docs/functions/mostFrequent.html +0 -144
  412. package/docs/functions/noop.html +0 -134
  413. package/docs/functions/occurrences.html +0 -158
  414. package/docs/functions/omit.html +0 -162
  415. package/docs/functions/pick.html +0 -162
  416. package/docs/functions/pull.html +0 -146
  417. package/docs/functions/remove.html +0 -162
  418. package/docs/functions/removeCommonProperties.html +0 -161
  419. package/docs/functions/replace.html +0 -151
  420. package/docs/functions/replaceDeep.html +0 -158
  421. package/docs/functions/rethrow.html +0 -139
  422. package/docs/functions/round.html +0 -148
  423. package/docs/functions/safe.html +0 -189
  424. package/docs/functions/sample.html +0 -146
  425. package/docs/functions/samples.html +0 -156
  426. package/docs/functions/scale.html +0 -150
  427. package/docs/functions/seq.html +0 -161
  428. package/docs/functions/seqEarlyBreak.html +0 -159
  429. package/docs/functions/serialize.html +0 -158
  430. package/docs/functions/set.html +0 -171
  431. package/docs/functions/setImmutable.html +0 -170
  432. package/docs/functions/shuffle.html +0 -146
  433. package/docs/functions/sortBy.html +0 -168
  434. package/docs/functions/sortProps.html +0 -156
  435. package/docs/functions/stripPrefix.html +0 -145
  436. package/docs/functions/stripSuffix.html +0 -145
  437. package/docs/functions/throttle.html +0 -164
  438. package/docs/functions/toggle.html +0 -151
  439. package/docs/functions/truthy.html +0 -151
  440. package/docs/functions/unique.html +0 -149
  441. package/docs/functions/wait.html +0 -142
  442. package/docs/functions/waitFor.html +0 -161
  443. package/docs/functions/waitSync.html +0 -142
  444. package/docs/interfaces/ComparePropsOptions.html +0 -70
  445. package/docs/interfaces/GetMultipleSource.html +0 -139
  446. package/docs/interfaces/GetSource.html +0 -139
  447. package/docs/interfaces/IsNumericStringOptions.html +0 -91
  448. package/docs/interfaces/OccurencesOptions.html +0 -72
  449. package/docs/interfaces/SetImmutableSource.html +0 -139
  450. package/docs/interfaces/SetSource.html +0 -139
  451. package/docs/interfaces/ThrottleOptions.html +0 -81
  452. package/docs/interfaces/ThrottledFunctionExtras.html +0 -97
  453. package/docs/modules.html +0 -217
  454. package/docs/pages/CHANGELOG.html +0 -924
  455. package/docs/pages/Introduction.html +0 -127
  456. package/docs/types/CustomDeserializers.html +0 -156
  457. package/docs/types/CustomSerializers.html +0 -156
  458. package/docs/types/Later.html +0 -170
  459. package/docs/types/MapValuesFn.html +0 -167
  460. package/docs/types/MatchCallback.html +0 -146
  461. package/docs/types/SeqEarlyBreaker.html +0 -147
  462. package/docs/types/SeqFn.html +0 -145
  463. package/docs/types/SeqFunctions.html +0 -138
  464. package/docs/types/SetImmutablePath.html +0 -132
  465. package/docs/types/ThrottledFunction.html +0 -146
  466. package/docs/variables/mapValuesUNSET.html +0 -134
  467. package/docs/variables/mergeUNSET.html +0 -136
  468. package/tutorials/Introduction.md +0 -1
@@ -0,0 +1,10 @@
1
+ <!DOCTYPE html><html class="default" lang="en"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>replace | @ezez/utils - v4.1.0</title><meta name="description" content="Documentation for @ezez/utils"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">@ezez/utils - v4.1.0</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../index.html">@ezez/utils</a></li><li><a href="../modules/index.html">index</a></li><li><a href="index.replace.html">replace</a></li></ul><h1>Function replace</h1></div><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><p>Replaces all occurrences of the keys in the replaceMap with the values.</p>
2
+ </div><div class="tsd-comment tsd-typography"><h4>Example</h4><pre><code class="ts"><span class="hl-2">replace</span><span class="hl-1">(</span><span class="hl-7">&quot;Hello, %name%!&quot;</span><span class="hl-1">, { </span><span class="hl-7">&quot;%name%: &quot;</span><span class="hl-3">John</span><span class="hl-7">&quot; }) // &quot;</span><span class="hl-3">Hello, John!</span><span class="hl-7">&quot;</span>
3
+ </code><button type="button">Copy</button></pre>
4
+
5
+ <h4>Example</h4><pre><code class="ts"><span class="hl-2">replace</span><span class="hl-1">(</span><span class="hl-7">&quot;Hello, %name%! Nice to meet you %name%!&quot;</span><span class="hl-1">, { </span><span class="hl-7">&quot;%name%&quot;</span><span class="hl-3">:</span><span class="hl-1"> </span><span class="hl-7">&quot;Jane&quot;</span><span class="hl-1"> }) </span><span class="hl-6">// &quot;Hello, Jane! Nice to meet you Jane!&quot;</span>
6
+ </code><button type="button">Copy</button></pre>
7
+
8
+ </div></section><section class="tsd-panel"><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="replace" class="tsd-anchor"></a><span class="tsd-kind-call-signature">replace</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">source</span>, <span class="tsd-kind-parameter">replaceMap</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><a href="#replace" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">source</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>source string</p>
9
+ </div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">replaceMap</span>: <span class="tsd-signature-type">Record</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">&gt;</span></span><div class="tsd-comment tsd-typography"><p>keys from this object will be replaced with values in source string</p>
10
+ </div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/dzek69/bottom-line/blob/e3307393551770c659e984ef501ad00f2839ca27/src/replace.ts#L10">replace.ts:10</a></li></ul></aside></li></ul></section></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-index-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-private" name="private"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Private</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav class="tsd-navigation"><a href="../index.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1"></use></svg><span>@ezez/utils - v4.1.0</span></a><ul class="tsd-small-nested-navigation" id="tsd-nav-container" data-base=".."><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
@@ -0,0 +1,15 @@
1
+ <!DOCTYPE html><html class="default" lang="en"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>replaceDeep | @ezez/utils - v4.1.0</title><meta name="description" content="Documentation for @ezez/utils"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">@ezez/utils - v4.1.0</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../index.html">@ezez/utils</a></li><li><a href="../modules/index.html">index</a></li><li><a href="index.replaceDeep.html">replaceDeep</a></li></ul><h1>Function replaceDeep</h1></div><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><p>Replaces all occurrences of <code>search</code> with <code>value</code> in <code>source</code> object/array. Comparison is done with <code>Object.is</code>.
2
+ If <code>source</code> is exactly the <code>search</code> a <code>value</code> will be returned. It does not do a substring replacements.</p>
3
+ <p>Warnings:</p>
4
+ <ul>
5
+ <li>By default, it does not mutate the <code>source</code>/deep objects/arrays, but it can be enabled with <code>mutate</code> option.</li>
6
+ <li>By default, it does not go into instances for replacement, only plain objects.</li>
7
+ <li>If your instances are cross-referenced, you may end up in an infinite loop.</li>
8
+ </ul>
9
+ <p>TypeScript users: This is way too dynamic to type properly, therefore, typing assumes the most basic form of
10
+ replacement where search and value are of the same type. If that's not the case for you - you'll have to typecast.</p>
11
+ </div><div class="tsd-comment tsd-typography"></div></section><section class="tsd-panel"><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="replaceDeep" class="tsd-anchor"></a><span class="tsd-kind-call-signature">replace<wbr/>Deep</span><span class="tsd-signature-symbol">&lt;</span><a class="tsd-signature-type tsd-kind-type-parameter" href="index.replaceDeep.html#replaceDeep.T">T</a><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">source</span>, <span class="tsd-kind-parameter">search</span>, <span class="tsd-kind-parameter">value</span>, <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a class="tsd-signature-type tsd-kind-type-parameter" href="index.replaceDeep.html#replaceDeep.T">T</a><a href="#replaceDeep" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span><a id="replaceDeep.T" class="tsd-anchor"></a><span class="tsd-kind-type-parameter">T</span></span></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">source</span>: <a class="tsd-signature-type tsd-kind-type-parameter" href="index.replaceDeep.html#replaceDeep.T">T</a></span><div class="tsd-comment tsd-typography"><p>source object/array/value</p>
12
+ </div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">search</span>: <span class="tsd-signature-type">unknown</span></span><div class="tsd-comment tsd-typography"><p>value to search for</p>
13
+ </div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">value</span>: <span class="tsd-signature-type">unknown</span></span><div class="tsd-comment tsd-typography"><p>value to replace with</p>
14
+ </div><div class="tsd-comment tsd-typography"></div></li><li><span><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-parameter">options</span>: <span class="tsd-signature-type">Options</span></span><div class="tsd-comment tsd-typography"><p>optional options</p>
15
+ </div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <a class="tsd-signature-type tsd-kind-type-parameter" href="index.replaceDeep.html#replaceDeep.T">T</a></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/dzek69/bottom-line/blob/e3307393551770c659e984ef501ad00f2839ca27/src/replaceDeep.ts#L33">replaceDeep.ts:33</a></li></ul></aside></li></ul></section></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-index-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-private" name="private"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Private</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav class="tsd-navigation"><a href="../index.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1"></use></svg><span>@ezez/utils - v4.1.0</span></a><ul class="tsd-small-nested-navigation" id="tsd-nav-container" data-base=".."><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
@@ -0,0 +1,2 @@
1
+ <!DOCTYPE html><html class="default" lang="en"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>rethrow | @ezez/utils - v4.1.0</title><meta name="description" content="Documentation for @ezez/utils"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">@ezez/utils - v4.1.0</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../index.html">@ezez/utils</a></li><li><a href="../modules/index.html">index</a></li><li><a href="index.rethrow.html">rethrow</a></li></ul><h1>Function rethrow</h1></div><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><p>Throws given value.</p>
2
+ </div><div class="tsd-comment tsd-typography"></div></section><section class="tsd-panel"><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="rethrow" class="tsd-anchor"></a><span class="tsd-kind-call-signature">rethrow</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">e</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">never</span><a href="#rethrow" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">e</span>: <span class="tsd-signature-type">unknown</span></span><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">never</span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/dzek69/bottom-line/blob/e3307393551770c659e984ef501ad00f2839ca27/src/rethrow.ts#L5">rethrow.ts:5</a></li></ul></aside></li></ul></section></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-index-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-private" name="private"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Private</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav class="tsd-navigation"><a href="../index.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1"></use></svg><span>@ezez/utils - v4.1.0</span></a><ul class="tsd-small-nested-navigation" id="tsd-nav-container" data-base=".."><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
@@ -0,0 +1,7 @@
1
+ <!DOCTYPE html><html class="default" lang="en"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>round | @ezez/utils - v4.1.0</title><meta name="description" content="Documentation for @ezez/utils"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">@ezez/utils - v4.1.0</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../index.html">@ezez/utils</a></li><li><a href="../modules/index.html">index</a></li><li><a href="index.round.html">round</a></li></ul><h1>Function round</h1></div><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><p>Rounds a number to a given precision</p>
2
+ </div><div class="tsd-comment tsd-typography"><h4>Example</h4><pre><code class="ts"><span class="hl-2">round</span><span class="hl-1">(</span><span class="hl-5">1.23</span><span class="hl-1">) </span><span class="hl-6">// 1</span><br/><span class="hl-2">round</span><span class="hl-1">(</span><span class="hl-5">1.55</span><span class="hl-1">) </span><span class="hl-6">// 2</span><br/><span class="hl-2">round</span><span class="hl-1">(</span><span class="hl-5">1.333</span><span class="hl-1">, </span><span class="hl-5">2</span><span class="hl-1">) </span><span class="hl-6">// 1.33</span><br/><span class="hl-2">round</span><span class="hl-1">(</span><span class="hl-5">1.2345</span><span class="hl-1">, </span><span class="hl-5">3</span><span class="hl-1">) </span><span class="hl-6">// 1.234</span>
3
+ </code><button type="button">Copy</button></pre>
4
+
5
+ </div></section><section class="tsd-panel"><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="round" class="tsd-anchor"></a><span class="tsd-kind-call-signature">round</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">value</span>, <span class="tsd-kind-parameter">precision</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><a href="#round" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">value</span>: <span class="tsd-signature-type">number</span></span><div class="tsd-comment tsd-typography"><p>value to round</p>
6
+ </div><div class="tsd-comment tsd-typography"></div></li><li><span><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-parameter">precision</span>: <span class="tsd-signature-type">number</span></span><div class="tsd-comment tsd-typography"><p>precision to round to</p>
7
+ </div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">number</span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/dzek69/bottom-line/blob/e3307393551770c659e984ef501ad00f2839ca27/src/round.ts#L13">round.ts:13</a></li></ul></aside></li></ul></section></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-index-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-private" name="private"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Private</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav class="tsd-navigation"><a href="../index.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1"></use></svg><span>@ezez/utils - v4.1.0</span></a><ul class="tsd-small-nested-navigation" id="tsd-nav-container" data-base=".."><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
@@ -0,0 +1,7 @@
1
+ <!DOCTYPE html><html class="default" lang="en"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>safe | @ezez/utils - v4.1.0</title><meta name="description" content="Documentation for @ezez/utils"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">@ezez/utils - v4.1.0</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../index.html">@ezez/utils</a></li><li><a href="../modules/index.html">index</a></li><li><a href="index.safe.html">safe</a></li></ul><h1>Function safe</h1></div><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><p>Safely execute a function, return its return value or default value if the function throws.</p>
2
+ </div><div class="tsd-comment tsd-typography"><h4>Param: fn</h4><p>function to run</p>
3
+ <h4>Param: def</h4><p>default value</p>
4
+ <h4>Example</h4><pre><code class="ts"><span class="hl-2">safe</span><span class="hl-1">(() </span><span class="hl-0">=&gt;</span><span class="hl-1"> </span><span class="hl-8">JSON</span><span class="hl-1">.</span><span class="hl-2">parse</span><span class="hl-1">(</span><span class="hl-3">unknownString</span><span class="hl-1">), </span><span class="hl-0">null</span><span class="hl-1">); </span><span class="hl-6">// if unknownString is not a valid JSON, null will be returned</span><br/><span class="hl-2">safe</span><span class="hl-1">(() </span><span class="hl-0">=&gt;</span><span class="hl-1"> </span><span class="hl-2">trySomethingComplicated</span><span class="hl-1">(), </span><span class="hl-3">defaultValue</span><span class="hl-1">); </span><span class="hl-6">// if trySomethingComplicated throws, defaultValue will be returned</span>
5
+ </code><button type="button">Copy</button></pre>
6
+
7
+ </div></section><section class="tsd-panel"><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="safe" class="tsd-anchor"></a><span class="tsd-kind-call-signature">safe</span><span class="tsd-signature-symbol">&lt;</span><a class="tsd-signature-type tsd-kind-type-parameter" href="index.safe.html#safe.T">T</a><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">fn</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a class="tsd-signature-type tsd-kind-type-parameter" href="index.safe.html#safe.T">T</a><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">undefined</span><a href="#safe" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span><a id="safe.T" class="tsd-anchor"></a><span class="tsd-kind-type-parameter">T</span></span></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">fn</span>: <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> =&gt; </span><a class="tsd-signature-type tsd-kind-type-parameter" href="index.safe.html#safe.T">T</a><span class="tsd-signature-symbol">)</span></span><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures"><li class="tsd-signature"><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a class="tsd-signature-type tsd-kind-type-parameter" href="index.safe.html#safe.T">T</a></li><li class="tsd-description"><h4 class="tsd-returns-title">Returns <a class="tsd-signature-type tsd-kind-type-parameter" href="index.safe.html#safe.T">T</a></h4></li></ul></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <a class="tsd-signature-type tsd-kind-type-parameter" href="index.safe.html#safe.T">T</a><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">undefined</span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/dzek69/bottom-line/blob/e3307393551770c659e984ef501ad00f2839ca27/src/safe.ts#L1">safe.ts:1</a></li></ul></aside></li><li class="tsd-signature tsd-anchor-link"><a id="safe-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">safe</span><span class="tsd-signature-symbol">&lt;</span><a class="tsd-signature-type tsd-kind-type-parameter" href="index.safe.html#safe-1.T-1">T</a><span class="tsd-signature-symbol">, </span><a class="tsd-signature-type tsd-kind-type-parameter" href="index.safe.html#safe-1.Y">Y</a><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">fn</span>, <span class="tsd-kind-parameter">def</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a class="tsd-signature-type tsd-kind-type-parameter" href="index.safe.html#safe-1.T-1">T</a><span class="tsd-signature-symbol"> | </span><a class="tsd-signature-type tsd-kind-type-parameter" href="index.safe.html#safe-1.Y">Y</a><a href="#safe-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span><a id="safe-1.T-1" class="tsd-anchor"></a><span class="tsd-kind-type-parameter">T</span></span></li><li><span><a id="safe-1.Y" class="tsd-anchor"></a><span class="tsd-kind-type-parameter">Y</span></span></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">fn</span>: <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> =&gt; </span><a class="tsd-signature-type tsd-kind-type-parameter" href="index.safe.html#safe-1.T-1">T</a><span class="tsd-signature-symbol">)</span></span><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures"><li class="tsd-signature"><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a class="tsd-signature-type tsd-kind-type-parameter" href="index.safe.html#safe-1.T-1">T</a></li><li class="tsd-description"><h4 class="tsd-returns-title">Returns <a class="tsd-signature-type tsd-kind-type-parameter" href="index.safe.html#safe-1.T-1">T</a></h4></li></ul></li></ul></li><li><span><span class="tsd-kind-parameter">def</span>: <a class="tsd-signature-type tsd-kind-type-parameter" href="index.safe.html#safe-1.Y">Y</a></span></li></ul></div><h4 class="tsd-returns-title">Returns <a class="tsd-signature-type tsd-kind-type-parameter" href="index.safe.html#safe-1.T-1">T</a><span class="tsd-signature-symbol"> | </span><a class="tsd-signature-type tsd-kind-type-parameter" href="index.safe.html#safe-1.Y">Y</a></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/dzek69/bottom-line/blob/e3307393551770c659e984ef501ad00f2839ca27/src/safe.ts#L2">safe.ts:2</a></li></ul></aside></li></ul></section></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-index-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-private" name="private"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Private</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav class="tsd-navigation"><a href="../index.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1"></use></svg><span>@ezez/utils - v4.1.0</span></a><ul class="tsd-small-nested-navigation" id="tsd-nav-container" data-base=".."><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
@@ -0,0 +1,6 @@
1
+ <!DOCTYPE html><html class="default" lang="en"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>sample | @ezez/utils - v4.1.0</title><meta name="description" content="Documentation for @ezez/utils"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">@ezez/utils - v4.1.0</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../index.html">@ezez/utils</a></li><li><a href="../modules/index.html">index</a></li><li><a href="index.sample.html">sample</a></li></ul><h1>Function sample</h1></div><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><p>Picks a random element from an array.</p>
2
+ </div><div class="tsd-comment tsd-typography"><h4>Example</h4><pre><code class="ts"><span class="hl-2">sample</span><span class="hl-1">([</span><span class="hl-5">1</span><span class="hl-1">, </span><span class="hl-5">2</span><span class="hl-1">, </span><span class="hl-5">3</span><span class="hl-1">]); </span><span class="hl-6">// 2 (type: number | undefined)</span><br/><span class="hl-2">sample</span><span class="hl-1">([</span><span class="hl-7">&quot;a&quot;</span><span class="hl-1">, </span><span class="hl-7">&quot;b&quot;</span><span class="hl-1">, </span><span class="hl-7">&quot;c&quot;</span><span class="hl-1">]); </span><span class="hl-6">// &quot;c&quot; (type: string | undefined)</span><br/><span class="hl-2">sample</span><span class="hl-1">([]); </span><span class="hl-6">// undefined (type: undefined)</span><br/><br/><span class="hl-0">const</span><span class="hl-1"> </span><span class="hl-8">a</span><span class="hl-1"> = [</span><span class="hl-5">1</span><span class="hl-1">, </span><span class="hl-5">2</span><span class="hl-1">, </span><span class="hl-5">3</span><span class="hl-1">] </span><span class="hl-4">as</span><span class="hl-1"> </span><span class="hl-0">const</span><span class="hl-1">;</span><br/><span class="hl-2">sample</span><span class="hl-1">(</span><span class="hl-3">a</span><span class="hl-1">); </span><span class="hl-6">// 2 (type: 1 | 2 | 3)</span><br/><br/><span class="hl-2">sample</span><span class="hl-1">([</span><span class="hl-5">1</span><span class="hl-1">, </span><span class="hl-5">1</span><span class="hl-1">, </span><span class="hl-5">1</span><span class="hl-1">] </span><span class="hl-4">as</span><span class="hl-1"> [</span><span class="hl-10">number</span><span class="hl-1">, </span><span class="hl-10">number</span><span class="hl-1">, </span><span class="hl-10">number</span><span class="hl-1">]); </span><span class="hl-6">// 1 (type: number)</span>
3
+ </code><button type="button">Copy</button></pre>
4
+
5
+ </div></section><section class="tsd-panel"><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="sample" class="tsd-anchor"></a><span class="tsd-kind-call-signature">sample</span><span class="tsd-signature-symbol">&lt;</span><a class="tsd-signature-type tsd-kind-type-parameter" href="index.sample.html#sample.X">X</a><span class="tsd-signature-symbol">, </span><a class="tsd-signature-type tsd-kind-type-parameter" href="index.sample.html#sample.T">T</a><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">array</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">MaybeTupleReturn</span><span class="tsd-signature-symbol">&lt;</span><a class="tsd-signature-type tsd-kind-type-parameter" href="index.sample.html#sample.T">T</a><span class="tsd-signature-symbol">&gt;</span><a href="#sample" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span><a id="sample.X" class="tsd-anchor"></a><span class="tsd-kind-type-parameter">X</span></span></li><li><span><a id="sample.T" class="tsd-anchor"></a><span class="tsd-kind-type-parameter">T</span><span class="tsd-signature-keyword"> extends </span><span class="tsd-signature-keyword">readonly </span><a class="tsd-signature-type tsd-kind-type-parameter" href="index.sample.html#sample.X">X</a><span class="tsd-signature-symbol">[]</span></span></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">array</span>: <a class="tsd-signature-type tsd-kind-type-parameter" href="index.sample.html#sample.T">T</a></span><div class="tsd-comment tsd-typography"><p>source array</p>
6
+ </div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">MaybeTupleReturn</span><span class="tsd-signature-symbol">&lt;</span><a class="tsd-signature-type tsd-kind-type-parameter" href="index.sample.html#sample.T">T</a><span class="tsd-signature-symbol">&gt;</span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/dzek69/bottom-line/blob/e3307393551770c659e984ef501ad00f2839ca27/src/sample.ts#L21">sample.ts:21</a></li></ul></aside></li></ul></section></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-index-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-private" name="private"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Private</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav class="tsd-navigation"><a href="../index.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1"></use></svg><span>@ezez/utils - v4.1.0</span></a><ul class="tsd-small-nested-navigation" id="tsd-nav-container" data-base=".."><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
@@ -0,0 +1,7 @@
1
+ <!DOCTYPE html><html class="default" lang="en"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>samples | @ezez/utils - v4.1.0</title><meta name="description" content="Documentation for @ezez/utils"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">@ezez/utils - v4.1.0</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../index.html">@ezez/utils</a></li><li><a href="../modules/index.html">index</a></li><li><a href="index.samples.html">samples</a></li></ul><h1>Function samples</h1></div><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><p>Picks a given number of random elements from the array. It won't pick the same element twice (unless the array has
2
+ duplicates).</p>
3
+ <p>If the number of elements to pick is greater than the array length, it will return the original array.</p>
4
+ </div><div class="tsd-comment tsd-typography"></div></section><section class="tsd-panel"><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="samples" class="tsd-anchor"></a><span class="tsd-kind-call-signature">samples</span><span class="tsd-signature-symbol">&lt;</span><a class="tsd-signature-type tsd-kind-type-parameter" href="index.samples.html#samples.T">T</a><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">array</span>, <span class="tsd-kind-parameter">elementsToPick</span>, <span class="tsd-kind-parameter">allowShuffle</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a class="tsd-signature-type tsd-kind-type-parameter" href="index.samples.html#samples.T">T</a><span class="tsd-signature-symbol">[]</span><a href="#samples" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span><a id="samples.T" class="tsd-anchor"></a><span class="tsd-kind-type-parameter">T</span></span></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">array</span>: <a class="tsd-signature-type tsd-kind-type-parameter" href="index.samples.html#samples.T">T</a><span class="tsd-signature-symbol">[]</span></span><div class="tsd-comment tsd-typography"><p>source array</p>
5
+ </div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">elementsToPick</span>: <span class="tsd-signature-type">number</span></span><div class="tsd-comment tsd-typography"><p>number of elements to pick</p>
6
+ </div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">allowShuffle</span>: <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> = false</span></span><div class="tsd-comment tsd-typography"><p>if true, it will shuffle the values if elementsToPick is greater or equal to array length instead of returning the original array</p>
7
+ </div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <a class="tsd-signature-type tsd-kind-type-parameter" href="index.samples.html#samples.T">T</a><span class="tsd-signature-symbol">[]</span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/dzek69/bottom-line/blob/e3307393551770c659e984ef501ad00f2839ca27/src/samples.ts#L11">samples.ts:11</a></li></ul></aside></li></ul></section></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-index-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-private" name="private"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Private</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav class="tsd-navigation"><a href="../index.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1"></use></svg><span>@ezez/utils - v4.1.0</span></a><ul class="tsd-small-nested-navigation" id="tsd-nav-container" data-base=".."><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
@@ -0,0 +1,5 @@
1
+ <!DOCTYPE html><html class="default" lang="en"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>scale | @ezez/utils - v4.1.0</title><meta name="description" content="Documentation for @ezez/utils"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">@ezez/utils - v4.1.0</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../index.html">@ezez/utils</a></li><li><a href="../modules/index.html">index</a></li><li><a href="index.scale.html">scale</a></li></ul><h1>Function scale</h1></div><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><p>Changes the scale of given value, i.e.: replaces values from 2.9 to 3.3 into values from 0 to 100. Useful for i.e.:
2
+ displaying measured battery voltage as a percent value.
3
+ Pro-tip: use <code>Function.prototype.bind</code> to create yourself a function with bound 4 first arguments to re-use without
4
+ repeating the from-to scale.</p>
5
+ </div><div class="tsd-comment tsd-typography"></div></section><section class="tsd-panel"><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="scale" class="tsd-anchor"></a><span class="tsd-kind-call-signature">scale</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">fromMin</span>, <span class="tsd-kind-parameter">fromMax</span>, <span class="tsd-kind-parameter">toMin</span>, <span class="tsd-kind-parameter">toMax</span>, <span class="tsd-kind-parameter">number</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><a href="#scale" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">fromMin</span>: <span class="tsd-signature-type">number</span></span><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">fromMax</span>: <span class="tsd-signature-type">number</span></span><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">toMin</span>: <span class="tsd-signature-type">number</span></span><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">toMax</span>: <span class="tsd-signature-type">number</span></span><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">number</span>: <span class="tsd-signature-type">number</span></span><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">number</span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/dzek69/bottom-line/blob/e3307393551770c659e984ef501ad00f2839ca27/src/scale.ts#L12">scale.ts:12</a></li></ul></aside></li></ul></section></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-index-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-private" name="private"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Private</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav class="tsd-navigation"><a href="../index.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1"></use></svg><span>@ezez/utils - v4.1.0</span></a><ul class="tsd-small-nested-navigation" id="tsd-nav-container" data-base=".."><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
@@ -0,0 +1,17 @@
1
+ <!DOCTYPE html><html class="default" lang="en"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>seq | @ezez/utils - v4.1.0</title><meta name="description" content="Documentation for @ezez/utils"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">@ezez/utils - v4.1.0</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../index.html">@ezez/utils</a></li><li><a href="../modules/index.html">index</a></li><li><a href="index.seq.html">seq</a></li></ul><h1>Function seq</h1></div><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><p>Runs given functions sequentially one by one, until any returns value. Supports async functions. Throws with new
2
+ Error when every function throws.</p>
3
+ </div><div class="tsd-comment tsd-typography"><h4>Example</h4><pre><code class="ts"><span class="hl-2">seq</span><span class="hl-1">(() </span><span class="hl-0">=&gt;</span><span class="hl-1"> </span><span class="hl-5">1</span><span class="hl-1">, () </span><span class="hl-0">=&gt;</span><span class="hl-1"> </span><span class="hl-5">2</span><span class="hl-1">, () </span><span class="hl-0">=&gt;</span><span class="hl-1"> </span><span class="hl-5">3</span><span class="hl-1">) </span><span class="hl-6">// returns 1</span>
4
+ </code><button type="button">Copy</button></pre>
5
+
6
+ <h4>Example</h4><pre><code class="ts"><span class="hl-2">seq</span><span class="hl-1">(() </span><span class="hl-0">=&gt;</span><span class="hl-1"> { </span><span class="hl-4">throw</span><span class="hl-1"> </span><span class="hl-0">new</span><span class="hl-1"> </span><span class="hl-2">Error</span><span class="hl-1">(</span><span class="hl-7">&quot;1&quot;</span><span class="hl-1">) }, () </span><span class="hl-0">=&gt;</span><span class="hl-1"> </span><span class="hl-5">2</span><span class="hl-1">, () </span><span class="hl-0">=&gt;</span><span class="hl-1"> </span><span class="hl-5">3</span><span class="hl-1">) </span><span class="hl-6">// returns 2</span>
7
+ </code><button type="button">Copy</button></pre>
8
+
9
+ <h4>Example</h4><pre><code class="ts"><span class="hl-2">seq</span><span class="hl-1">(() </span><span class="hl-0">=&gt;</span><span class="hl-1"> { </span><span class="hl-4">throw</span><span class="hl-1"> </span><span class="hl-0">new</span><span class="hl-1"> </span><span class="hl-2">Error</span><span class="hl-1">(</span><span class="hl-7">&quot;1&quot;</span><span class="hl-1">) }, () </span><span class="hl-0">=&gt;</span><span class="hl-1"> { </span><span class="hl-4">throw</span><span class="hl-1"> </span><span class="hl-0">new</span><span class="hl-1"> </span><span class="hl-2">Error</span><span class="hl-1">(</span><span class="hl-7">&quot;2&quot;</span><span class="hl-1">) } }) </span><span class="hl-6">// throws</span>
10
+ </code><button type="button">Copy</button></pre>
11
+
12
+ </div></section><section class="tsd-panel"><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="seq" class="tsd-anchor"></a><span class="tsd-kind-call-signature">seq</span><span class="tsd-signature-symbol">&lt;</span><a class="tsd-signature-type tsd-kind-type-parameter" href="index.seq.html#seq.T">T</a><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">...</span><span class="tsd-kind-parameter">fns</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><a class="tsd-signature-type tsd-kind-type-parameter" href="index.seq.html#seq.T">T</a><span class="tsd-signature-symbol">&gt;</span><a href="#seq" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span><a id="seq.T" class="tsd-anchor"></a><span class="tsd-kind-type-parameter">T</span></span></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><code class="tsd-tag ts-flagRest">Rest</code> <span class="tsd-signature-symbol">...</span><span class="tsd-kind-parameter">fns</span>: <a href="../types/index.SeqFunctions.html" class="tsd-signature-type tsd-kind-type-alias">SeqFunctions</a><span class="tsd-signature-symbol">&lt;</span><a class="tsd-signature-type tsd-kind-type-parameter" href="index.seq.html#seq.T">T</a><span class="tsd-signature-symbol">&gt;</span></span><div class="tsd-comment tsd-typography"><p>functions to run, you can either pass them as many arguments or just single
13
+ arguments with array</p>
14
+ </div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><a class="tsd-signature-type tsd-kind-type-parameter" href="index.seq.html#seq.T">T</a><span class="tsd-signature-symbol">&gt;</span></h4><ul>
15
+ <li>whatever gets returned from given functions</li>
16
+ </ul>
17
+ <div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/dzek69/bottom-line/blob/e3307393551770c659e984ef501ad00f2839ca27/src/seq.ts#L94">seq.ts:94</a></li></ul></aside></li></ul></section></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-index-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-private" name="private"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Private</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav class="tsd-navigation"><a href="../index.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1"></use></svg><span>@ezez/utils - v4.1.0</span></a><ul class="tsd-small-nested-navigation" id="tsd-nav-container" data-base=".."><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
@@ -0,0 +1,12 @@
1
+ <!DOCTYPE html><html class="default" lang="en"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>seqEarlyBreak | @ezez/utils - v4.1.0</title><meta name="description" content="Documentation for @ezez/utils"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">@ezez/utils - v4.1.0</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../index.html">@ezez/utils</a></li><li><a href="../modules/index.html">index</a></li><li><a href="index.seqEarlyBreak.html">seqEarlyBreak</a></li></ul><h1>Function seqEarlyBreak</h1></div><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><p>The same as <a href="index.seq.html">seq</a> but accepts a function that gets run after each error and using that erro decides if continue
2
+ to try next functions.</p>
3
+ </div><div class="tsd-comment tsd-typography"><h4>Example</h4><pre><code class="ts"><span class="hl-2">seqEarlyBreak</span><span class="hl-1">(</span><br/><span class="hl-1"> (</span><span class="hl-3">e</span><span class="hl-1">) </span><span class="hl-0">=&gt;</span><span class="hl-1"> </span><span class="hl-3">e</span><span class="hl-1">.</span><span class="hl-3">message</span><span class="hl-1"> === </span><span class="hl-7">&quot;important error&quot;</span><span class="hl-1">,</span><br/><span class="hl-1"> () </span><span class="hl-0">=&gt;</span><span class="hl-1"> { </span><span class="hl-4">throw</span><span class="hl-1"> </span><span class="hl-0">new</span><span class="hl-1"> </span><span class="hl-2">Error</span><span class="hl-1">(</span><span class="hl-7">&quot;important error&quot;</span><span class="hl-1">) }, () </span><span class="hl-0">=&gt;</span><span class="hl-1"> </span><span class="hl-5">2</span><span class="hl-1">, () </span><span class="hl-0">=&gt;</span><span class="hl-1"> </span><span class="hl-5">3</span><br/><span class="hl-1">) </span><span class="hl-6">// throws given important error, does not run next functions</span>
4
+ </code><button type="button">Copy</button></pre>
5
+
6
+ </div></section><section class="tsd-panel"><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="seqEarlyBreak" class="tsd-anchor"></a><span class="tsd-kind-call-signature">seq<wbr/>Early<wbr/>Break</span><span class="tsd-signature-symbol">&lt;</span><a class="tsd-signature-type tsd-kind-type-parameter" href="index.seqEarlyBreak.html#seqEarlyBreak.T">T</a><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">earlyBreaker</span>, <span class="tsd-signature-symbol">...</span><span class="tsd-kind-parameter">args</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><a class="tsd-signature-type tsd-kind-type-parameter" href="index.seqEarlyBreak.html#seqEarlyBreak.T">T</a><span class="tsd-signature-symbol">&gt;</span><a href="#seqEarlyBreak" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span><a id="seqEarlyBreak.T" class="tsd-anchor"></a><span class="tsd-kind-type-parameter">T</span></span></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">earlyBreaker</span>: <span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><a href="../types/index.SeqEarlyBreaker.html" class="tsd-signature-type tsd-kind-type-alias">SeqEarlyBreaker</a></span><div class="tsd-comment tsd-typography"><p>function that decides about early breaking the sequential run</p>
7
+ </div><div class="tsd-comment tsd-typography"></div></li><li><span><code class="tsd-tag ts-flagRest">Rest</code> <span class="tsd-signature-symbol">...</span><span class="tsd-kind-parameter">args</span>: <a href="../types/index.SeqFunctions.html" class="tsd-signature-type tsd-kind-type-alias">SeqFunctions</a><span class="tsd-signature-symbol">&lt;</span><a class="tsd-signature-type tsd-kind-type-parameter" href="index.seqEarlyBreak.html#seqEarlyBreak.T">T</a><span class="tsd-signature-symbol">&gt;</span></span><div class="tsd-comment tsd-typography"><p>functions to run, you can either pass them as many arguments or just single
8
+ arguments with array</p>
9
+ </div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><a class="tsd-signature-type tsd-kind-type-parameter" href="index.seqEarlyBreak.html#seqEarlyBreak.T">T</a><span class="tsd-signature-symbol">&gt;</span></h4><ul>
10
+ <li>whatever gets returned from given functions</li>
11
+ </ul>
12
+ <div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/dzek69/bottom-line/blob/e3307393551770c659e984ef501ad00f2839ca27/src/seq.ts#L76">seq.ts:76</a></li></ul></aside></li></ul></section></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-index-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-private" name="private"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Private</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav class="tsd-navigation"><a href="../index.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1"></use></svg><span>@ezez/utils - v4.1.0</span></a><ul class="tsd-small-nested-navigation" id="tsd-nav-container" data-base=".."><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html><html class="default" lang="en"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>serialize | @ezez/utils - v4.1.0</title><meta name="description" content="Documentation for @ezez/utils"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">@ezez/utils - v4.1.0</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../index.html">@ezez/utils</a></li><li><a href="../modules/index.html">index</a></li><li><a href="index.serialize.html">serialize</a></li></ul><h1>Function serialize</h1></div><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><p>Serializes the data into a string. Think of it as a JSON.stringify on steroids.
2
+ In opposite to JSON.stringify it supports serializing undefined.</p>
3
+ <p>It also supports custom serializers, which can be used to serialize custom data types. Each value has a prefix which
4
+ specifies the type of the value, custom serializers is a map of these prefixes to functions which can serialize the
5
+ value into a string. IMPORTANT: Because this is using JSON.serialize under the hood if a value to serialize includes
6
+ <code>toJSON</code> it won't trigger custom serializer but will be serialized as string. <code>Date</code> class defines <code>toJSON</code> method!</p>
7
+ <p>The extra aim of this function is to produce the same output for &quot;the same&quot; data, regardless of the order of the keys
8
+ (which is not guaranteed by JS spec, but in practice it is guaranteed by current implementations of all JS engines),
9
+ so it sorts the keys and when serializing data by default, you can opt-out of this behavior by passing
10
+ <code>{ sortProps: false }</code> as the third argument.</p>
11
+ </div><div class="tsd-comment tsd-typography"></div></section><section class="tsd-panel"><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="serialize" class="tsd-anchor"></a><span class="tsd-kind-call-signature">serialize</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">data</span>, <span class="tsd-kind-parameter">customSerializers</span><span class="tsd-signature-symbol">?</span>, <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><a href="#serialize" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">data</span>: <span class="tsd-signature-type">unknown</span></span><div class="tsd-comment tsd-typography"><p>the data to serialize</p>
12
+ </div><div class="tsd-comment tsd-typography"></div></li><li><span><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-parameter">customSerializers</span>: <a href="../types/index.CustomSerializers.html" class="tsd-signature-type tsd-kind-type-alias">CustomSerializers</a></span><div class="tsd-comment tsd-typography"><p>an object with custom serializers</p>
13
+ </div><div class="tsd-comment tsd-typography"></div></li><li><span><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-parameter">options</span>: <span class="tsd-signature-type">Options</span></span><div class="tsd-comment tsd-typography"><p>options</p>
14
+ </div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/dzek69/bottom-line/blob/e3307393551770c659e984ef501ad00f2839ca27/src/serialize.ts#L38">serialize.ts:38</a></li></ul></aside></li></ul></section></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-index-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-private" name="private"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Private</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav class="tsd-navigation"><a href="../index.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1"></use></svg><span>@ezez/utils - v4.1.0</span></a><ul class="tsd-small-nested-navigation" id="tsd-nav-container" data-base=".."><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html><html class="default" lang="en"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>set | @ezez/utils - v4.1.0</title><meta name="description" content="Documentation for @ezez/utils"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">@ezez/utils - v4.1.0</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../index.html">@ezez/utils</a></li><li><a href="../modules/index.html">index</a></li><li><a href="index.set.html">set</a></li></ul><h1>Function set</h1></div><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><p>Updates the value at given path of given object. It mutates the object. If path is not found then objects are created
2
+ &quot;on the way&quot;. If non-objects are found, they are replaced with new plain objects. If primitives are used as source
3
+ they are ignored and returned value is empty object with updated value at given path.</p>
4
+ <p>This is still too dynamic in nature to get full TypeScript support. Properties are not typed, return type is unknown.
5
+ If you are okay with NOT mutating the object but get new one instead it is recommended to use <code>immutable-assign</code>
6
+ package instead.</p>
7
+ </div><div class="tsd-comment tsd-typography"><h4>Example</h4><pre><code class="ts"><span class="hl-2">set</span><span class="hl-1">(</span><span class="hl-3">object</span><span class="hl-1">, </span><span class="hl-7">&quot;deep.property&quot;</span><span class="hl-1">, </span><span class="hl-3">value</span><span class="hl-1">)</span>
8
+ </code><button type="button">Copy</button></pre>
9
+
10
+ <h4>Example</h4><pre><code class="ts"><span class="hl-2">set</span><span class="hl-1">(</span><span class="hl-3">object</span><span class="hl-1">, [</span><span class="hl-7">&quot;deep&quot;</span><span class="hl-1">, </span><span class="hl-7">&quot;property&quot;</span><span class="hl-1">], </span><span class="hl-3">value</span><span class="hl-1">)</span>
11
+ </code><button type="button">Copy</button></pre>
12
+
13
+ <h4>Example</h4><pre><code class="ts"><span class="hl-2">set</span><span class="hl-1">({}, </span><span class="hl-7">&quot;deep[0].property&quot;</span><span class="hl-1">, </span><span class="hl-3">value</span><span class="hl-1">)</span><br/><span class="hl-6">// will create this structure:</span><br/><span class="hl-1">{ </span><span class="hl-7">&quot;deep[0]&quot;</span><span class="hl-1">: { </span><span class="hl-7">&quot;property&quot;</span><span class="hl-3">:</span><span class="hl-1"> </span><span class="hl-3">value</span><span class="hl-1"> }}</span>
14
+ </code><button type="button">Copy</button></pre>
15
+
16
+ <h4>Example</h4><pre><code class="ts"><span class="hl-2">set</span><span class="hl-1">({}, </span><span class="hl-7">&quot;items.0&quot;</span><span class="hl-1">, </span><span class="hl-3">value</span><span class="hl-1">)</span><br/><span class="hl-6">// will create object, not array</span><br/><span class="hl-1">{ </span><span class="hl-7">&quot;items&quot;</span><span class="hl-1">: { </span><span class="hl-7">&quot;0&quot;</span><span class="hl-3">:</span><span class="hl-1"> </span><span class="hl-3">value</span><span class="hl-1"> }}</span>
17
+ </code><button type="button">Copy</button></pre>
18
+
19
+ </div></section><section class="tsd-panel"><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="set" class="tsd-anchor"></a><span class="tsd-kind-call-signature">set</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">source</span>, <span class="tsd-kind-parameter">path</span>, <span class="tsd-kind-parameter">value</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">unknown</span><a href="#set" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">source</span>: <a href="../interfaces/index.SetSource.html" class="tsd-signature-type tsd-kind-interface">SetSource</a></span><div class="tsd-comment tsd-typography"><p>source object to mutate</p>
20
+ </div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">path</span>: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span></span><div class="tsd-comment tsd-typography"><p>path where value should be stored, written as dot-separated property names or
21
+ array with property names. Use Array when your keys includes dots.</p>
22
+ </div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">value</span>: <span class="tsd-signature-type">unknown</span></span><div class="tsd-comment tsd-typography"><p>value to be set</p>
23
+ </div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">unknown</span></h4><ul>
24
+ <li>given object or new object if source was primitive</li>
25
+ </ul>
26
+ <div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/dzek69/bottom-line/blob/e3307393551770c659e984ef501ad00f2839ca27/src/set.ts#L33">set.ts:33</a></li></ul></aside></li></ul></section></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-index-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-private" name="private"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Private</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav class="tsd-navigation"><a href="../index.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1"></use></svg><span>@ezez/utils - v4.1.0</span></a><ul class="tsd-small-nested-navigation" id="tsd-nav-container" data-base=".."><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>