@koine/utils 2.0.0-beta.2 → 2.0.0-beta.21

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 (702) hide show
  1. package/Defer.d.ts +0 -14
  2. package/Defer.js +2 -21
  3. package/Emitter.d.ts +0 -18
  4. package/Emitter.js +2 -24
  5. package/accentSets.d.ts +0 -13
  6. package/accentSets.js +2 -13
  7. package/addOrReplaceAtIdx.d.ts +0 -3
  8. package/addOrReplaceAtIdx.js +4 -11
  9. package/areEqual.d.ts +0 -15
  10. package/areEqual.js +24 -39
  11. package/arrayOfAll.d.ts +0 -26
  12. package/arrayOfAll.js +2 -32
  13. package/arraySum.d.ts +0 -5
  14. package/arraySum.js +2 -11
  15. package/arrayToLookup.d.ts +0 -5
  16. package/arrayToLookup.js +2 -11
  17. package/arrayUniqueByProperties.d.ts +2 -0
  18. package/arrayUniqueByProperties.js +8 -0
  19. package/buildUrlQueryString.d.ts +1 -10
  20. package/buildUrlQueryString.js +7 -22
  21. package/capitalize.d.ts +0 -6
  22. package/capitalize.js +2 -12
  23. package/changeUrlPath.d.ts +0 -8
  24. package/changeUrlPath.js +6 -19
  25. package/chunkByChunks.d.ts +0 -5
  26. package/chunkByChunks.js +2 -11
  27. package/chunkBySize.d.ts +0 -4
  28. package/chunkBySize.js +2 -10
  29. package/cjs/Defer.d.ts +6 -0
  30. package/cjs/Defer.js +15 -0
  31. package/cjs/Emitter.d.ts +7 -0
  32. package/{Emitter.mjs → cjs/Emitter.js} +6 -20
  33. package/cjs/accentSets.d.ts +3 -0
  34. package/{accentSets.mjs → cjs/accentSets.js} +5 -10
  35. package/cjs/addOrReplaceAtIdx.d.ts +2 -0
  36. package/cjs/addOrReplaceAtIdx.js +20 -0
  37. package/cjs/areEqual.d.ts +4 -0
  38. package/cjs/areEqual.js +70 -0
  39. package/cjs/arrayOfAll.d.ts +2 -0
  40. package/cjs/arrayOfAll.js +10 -0
  41. package/cjs/arraySum.d.ts +2 -0
  42. package/cjs/arraySum.js +8 -0
  43. package/cjs/arrayToLookup.d.ts +2 -0
  44. package/cjs/arrayToLookup.js +12 -0
  45. package/cjs/arrayUniqueByProperties.d.ts +2 -0
  46. package/cjs/arrayUniqueByProperties.js +12 -0
  47. package/cjs/buildUrlQueryString.d.ts +3 -0
  48. package/cjs/buildUrlQueryString.js +25 -0
  49. package/cjs/capitalize.d.ts +2 -0
  50. package/cjs/capitalize.js +10 -0
  51. package/cjs/changeUrlPath.d.ts +2 -0
  52. package/cjs/changeUrlPath.js +14 -0
  53. package/cjs/chunkByChunks.d.ts +2 -0
  54. package/{chunkByChunks.mjs → cjs/chunkByChunks.js} +6 -7
  55. package/cjs/chunkBySize.d.ts +2 -0
  56. package/cjs/chunkBySize.js +12 -0
  57. package/cjs/clamp.d.ts +2 -0
  58. package/cjs/clamp.js +8 -0
  59. package/cjs/clsx.d.ts +6 -0
  60. package/{clsx.mjs → cjs/clsx.js} +6 -11
  61. package/cjs/convertRange.d.ts +2 -0
  62. package/cjs/convertRange.js +8 -0
  63. package/cjs/cookie.d.ts +18 -0
  64. package/cjs/cookie.js +4 -0
  65. package/cjs/createPalette.d.ts +10 -0
  66. package/cjs/createPalette.js +16 -0
  67. package/cjs/debounce.d.ts +2 -0
  68. package/{debounce.mjs → cjs/debounce.js} +6 -9
  69. package/cjs/debouncePromise.d.ts +11 -0
  70. package/cjs/debouncePromise.js +69 -0
  71. package/cjs/debounceRaf.d.ts +2 -0
  72. package/cjs/debounceRaf.js +21 -0
  73. package/cjs/decode.d.ts +2 -0
  74. package/cjs/decode.js +10 -0
  75. package/cjs/encode.d.ts +2 -0
  76. package/cjs/encode.js +10 -0
  77. package/cjs/ensureInt.d.ts +2 -0
  78. package/cjs/ensureInt.js +8 -0
  79. package/cjs/env.d.ts +0 -0
  80. package/cjs/env.js +1 -0
  81. package/cjs/errorToString.d.ts +2 -0
  82. package/cjs/errorToString.js +9 -0
  83. package/cjs/findDuplicatedIndexes.d.ts +2 -0
  84. package/cjs/findDuplicatedIndexes.js +15 -0
  85. package/cjs/forin.d.ts +2 -0
  86. package/cjs/forin.js +10 -0
  87. package/cjs/gbToBytes.d.ts +2 -0
  88. package/cjs/gbToBytes.js +6 -0
  89. package/cjs/getEmptyArray.d.ts +2 -0
  90. package/cjs/getEmptyArray.js +12 -0
  91. package/cjs/getKeys.d.ts +2 -0
  92. package/cjs/getKeys.js +5 -0
  93. package/cjs/getMediaQueryWidthResolvers.d.ts +10 -0
  94. package/{getMediaQueryWidthResolvers.mjs → cjs/getMediaQueryWidthResolvers.js} +8 -32
  95. package/cjs/getMediaQueryWidthTailwindScreens.d.ts +5 -0
  96. package/{getMediaQueryWidthTailwindScreens.mjs → cjs/getMediaQueryWidthTailwindScreens.js} +8 -6
  97. package/cjs/getNonce.d.ts +2 -0
  98. package/cjs/getNonce.js +9 -0
  99. package/cjs/getParamAmong.d.ts +2 -0
  100. package/cjs/getParamAmong.js +11 -0
  101. package/cjs/getParamAsInt.d.ts +2 -0
  102. package/cjs/getParamAsInt.js +14 -0
  103. package/cjs/getParamAsString.d.ts +2 -0
  104. package/cjs/getParamAsString.js +9 -0
  105. package/cjs/getType.d.ts +7 -0
  106. package/cjs/getType.js +8 -0
  107. package/cjs/getUrlHashParams.d.ts +3 -0
  108. package/cjs/getUrlHashParams.js +14 -0
  109. package/cjs/getUrlHashPathname.d.ts +2 -0
  110. package/cjs/getUrlHashPathname.js +10 -0
  111. package/cjs/getUrlPathnameParts.d.ts +2 -0
  112. package/cjs/getUrlPathnameParts.js +14 -0
  113. package/cjs/getUrlQueryParams.d.ts +3 -0
  114. package/cjs/getUrlQueryParams.js +29 -0
  115. package/cjs/imgEmptyPixel.d.ts +2 -0
  116. package/cjs/imgEmptyPixel.js +5 -0
  117. package/{index.mjs → cjs/index.d.ts} +15 -8
  118. package/cjs/index.js +275 -0
  119. package/cjs/invariant.d.ts +2 -0
  120. package/cjs/invariant.js +21 -0
  121. package/cjs/isAnyObject.d.ts +3 -0
  122. package/cjs/isAnyObject.js +9 -0
  123. package/cjs/isArray.d.ts +2 -0
  124. package/cjs/isArray.js +9 -0
  125. package/cjs/isBlob.d.ts +2 -0
  126. package/cjs/isBlob.js +9 -0
  127. package/cjs/isBoolean.d.ts +2 -0
  128. package/cjs/isBoolean.js +9 -0
  129. package/cjs/isBrowser.d.ts +2 -0
  130. package/cjs/isBrowser.js +5 -0
  131. package/cjs/isBrowserNow.d.ts +2 -0
  132. package/cjs/isBrowserNow.js +7 -0
  133. package/cjs/isDate.d.ts +2 -0
  134. package/cjs/isDate.js +9 -0
  135. package/cjs/isEmptyArray.d.ts +2 -0
  136. package/cjs/isEmptyArray.js +9 -0
  137. package/cjs/isEmptyObject.d.ts +4 -0
  138. package/cjs/isEmptyObject.js +9 -0
  139. package/cjs/isEmptyString.d.ts +2 -0
  140. package/cjs/isEmptyString.js +8 -0
  141. package/cjs/isError.d.ts +2 -0
  142. package/cjs/isError.js +9 -0
  143. package/cjs/isExternalUrl.d.ts +2 -0
  144. package/cjs/isExternalUrl.js +16 -0
  145. package/cjs/isFile.d.ts +2 -0
  146. package/cjs/isFile.js +9 -0
  147. package/cjs/isFloat.d.ts +2 -0
  148. package/cjs/isFloat.js +9 -0
  149. package/cjs/isFormData.d.ts +2 -0
  150. package/cjs/isFormData.js +9 -0
  151. package/cjs/isFullArray.d.ts +2 -0
  152. package/cjs/isFullArray.js +9 -0
  153. package/cjs/isFullObject.d.ts +3 -0
  154. package/cjs/isFullObject.js +9 -0
  155. package/cjs/isFullString.d.ts +2 -0
  156. package/cjs/isFullString.js +9 -0
  157. package/cjs/isFunction.d.ts +3 -0
  158. package/cjs/isFunction.js +8 -0
  159. package/cjs/isInt.d.ts +2 -0
  160. package/cjs/isInt.js +9 -0
  161. package/cjs/isMap.d.ts +2 -0
  162. package/cjs/isMap.js +9 -0
  163. package/cjs/isNaNValue.d.ts +2 -0
  164. package/cjs/isNaNValue.js +9 -0
  165. package/cjs/isNegativeNumber.d.ts +2 -0
  166. package/cjs/isNegativeNumber.js +9 -0
  167. package/cjs/isNull.d.ts +2 -0
  168. package/cjs/isNull.js +9 -0
  169. package/cjs/isNullOrUndefined.d.ts +2 -0
  170. package/cjs/isNullOrUndefined.js +8 -0
  171. package/cjs/isNumber.d.ts +2 -0
  172. package/cjs/isNumber.js +9 -0
  173. package/cjs/isObject.d.ts +3 -0
  174. package/cjs/isObject.js +9 -0
  175. package/cjs/isObjectLike.d.ts +3 -0
  176. package/cjs/isObjectLike.js +9 -0
  177. package/cjs/isOneOf.d.ts +6 -0
  178. package/cjs/isOneOf.js +14 -0
  179. package/cjs/isPlainObject.d.ts +3 -0
  180. package/cjs/isPlainObject.js +12 -0
  181. package/cjs/isPositiveNumber.d.ts +2 -0
  182. package/cjs/isPositiveNumber.js +9 -0
  183. package/cjs/isPrimitive.d.ts +2 -0
  184. package/cjs/isPrimitive.js +19 -0
  185. package/cjs/isPromise.d.ts +2 -0
  186. package/cjs/isPromise.js +9 -0
  187. package/cjs/isRegExp.d.ts +2 -0
  188. package/cjs/isRegExp.js +9 -0
  189. package/cjs/isServer.d.ts +2 -0
  190. package/cjs/isServer.js +6 -0
  191. package/cjs/isServerNow.d.ts +2 -0
  192. package/cjs/isServerNow.js +7 -0
  193. package/cjs/isSet.d.ts +2 -0
  194. package/cjs/isSet.js +9 -0
  195. package/cjs/isString.d.ts +2 -0
  196. package/cjs/isString.js +9 -0
  197. package/cjs/isSymbol.d.ts +2 -0
  198. package/cjs/isSymbol.js +9 -0
  199. package/cjs/isType.d.ts +3 -0
  200. package/cjs/isType.js +17 -0
  201. package/cjs/isUndefined.d.ts +2 -0
  202. package/cjs/isUndefined.js +9 -0
  203. package/cjs/isWeakMap.d.ts +2 -0
  204. package/cjs/isWeakMap.js +9 -0
  205. package/cjs/isWeakSet.d.ts +2 -0
  206. package/cjs/isWeakSet.js +9 -0
  207. package/cjs/kbToBytes.d.ts +2 -0
  208. package/cjs/kbToBytes.js +6 -0
  209. package/cjs/location.d.ts +1 -0
  210. package/cjs/location.js +2 -0
  211. package/cjs/lowercase.d.ts +2 -0
  212. package/cjs/lowercase.js +8 -0
  213. package/cjs/mapListBy.d.ts +2 -0
  214. package/cjs/mapListBy.js +13 -0
  215. package/cjs/matchSorter.d.ts +54 -0
  216. package/{matchSorter.mjs → cjs/matchSorter.js} +13 -124
  217. package/cjs/mbToBytes.d.ts +2 -0
  218. package/cjs/mbToBytes.js +6 -0
  219. package/cjs/mergeObjects.d.ts +1 -0
  220. package/cjs/mergeObjects.js +37 -0
  221. package/cjs/mergeUrlQueryParams.d.ts +3 -0
  222. package/cjs/mergeUrlQueryParams.js +20 -0
  223. package/cjs/moveSortableArrayItemByKey.d.ts +2 -0
  224. package/cjs/moveSortableArrayItemByKey.js +14 -0
  225. package/cjs/noop.d.ts +2 -0
  226. package/cjs/noop.js +6 -0
  227. package/cjs/normaliseUrl.d.ts +2 -0
  228. package/cjs/normaliseUrl.js +10 -0
  229. package/cjs/normaliseUrlPathname.d.ts +2 -0
  230. package/cjs/normaliseUrlPathname.js +10 -0
  231. package/cjs/objectFlip.d.ts +2 -0
  232. package/cjs/objectFlip.js +15 -0
  233. package/cjs/objectOmit.d.ts +2 -0
  234. package/cjs/objectOmit.js +14 -0
  235. package/cjs/objectPick.d.ts +2 -0
  236. package/cjs/objectPick.js +13 -0
  237. package/cjs/objectToArray.d.ts +2 -0
  238. package/cjs/objectToArray.js +8 -0
  239. package/cjs/package.json +6 -0
  240. package/cjs/parseCookie.d.ts +3 -0
  241. package/{parseCookie.mjs → cjs/parseCookie.js} +6 -16
  242. package/cjs/parseURL.d.ts +11 -0
  243. package/{parseURL.mjs → cjs/parseURL.js} +6 -8
  244. package/cjs/quaranteneProps.d.ts +7 -0
  245. package/cjs/quaranteneProps.js +20 -0
  246. package/cjs/randomInt.d.ts +2 -0
  247. package/cjs/randomInt.js +8 -0
  248. package/cjs/randomKey.d.ts +2 -0
  249. package/cjs/randomKey.js +9 -0
  250. package/cjs/readCookie.d.ts +3 -0
  251. package/{readCookie.mjs → cjs/readCookie.js} +8 -4
  252. package/cjs/removeAccents.d.ts +3 -0
  253. package/cjs/removeAccents.js +17 -0
  254. package/cjs/removeCookie.d.ts +3 -0
  255. package/cjs/removeCookie.js +12 -0
  256. package/cjs/removeDuplicates.d.ts +0 -0
  257. package/cjs/removeDuplicates.js +1 -0
  258. package/cjs/removeDuplicatesByKey.d.ts +2 -0
  259. package/{removeDuplicatesByKey.mjs → cjs/removeDuplicatesByKey.js} +6 -8
  260. package/cjs/removeDuplicatesComparing.d.ts +2 -0
  261. package/cjs/removeDuplicatesComparing.js +11 -0
  262. package/cjs/removeIndexesFromArray.d.ts +2 -0
  263. package/cjs/removeIndexesFromArray.js +14 -0
  264. package/cjs/removeTrailingSlash.d.ts +2 -0
  265. package/cjs/removeTrailingSlash.js +9 -0
  266. package/cjs/removeUrlQueryParams.d.ts +2 -0
  267. package/cjs/removeUrlQueryParams.js +19 -0
  268. package/cjs/render.d.ts +13 -0
  269. package/{render.mjs → cjs/render.js} +8 -50
  270. package/cjs/round.d.ts +3 -0
  271. package/cjs/round.js +10 -0
  272. package/cjs/roundTo.d.ts +2 -0
  273. package/cjs/roundTo.js +16 -0
  274. package/cjs/serializeCookie.d.ts +3 -0
  275. package/{serializeCookie.mjs → cjs/serializeCookie.js} +11 -41
  276. package/cjs/setCookie.d.ts +3 -0
  277. package/{setCookie.mjs → cjs/setCookie.js} +15 -26
  278. package/cjs/shuffle.d.ts +2 -0
  279. package/cjs/shuffle.js +22 -0
  280. package/cjs/slugify.d.ts +2 -0
  281. package/cjs/slugify.js +18 -0
  282. package/cjs/split.d.ts +3 -0
  283. package/cjs/split.js +6 -0
  284. package/cjs/swapMap.d.ts +2 -0
  285. package/cjs/swapMap.js +13 -0
  286. package/cjs/throttle.d.ts +2 -0
  287. package/{throttle.mjs → cjs/throttle.js} +8 -10
  288. package/cjs/titleCase.d.ts +2 -0
  289. package/cjs/titleCase.js +10 -0
  290. package/cjs/toNumber.d.ts +2 -0
  291. package/cjs/toNumber.js +9 -0
  292. package/cjs/toRgba.d.ts +2 -0
  293. package/cjs/toRgba.js +13 -0
  294. package/cjs/transformToUrlPathname.d.ts +2 -0
  295. package/cjs/transformToUrlPathname.js +11 -0
  296. package/cjs/truncate.d.ts +2 -0
  297. package/cjs/truncate.js +12 -0
  298. package/cjs/tryUntil.d.ts +2 -0
  299. package/cjs/tryUntil.js +19 -0
  300. package/cjs/types.d.ts +10 -0
  301. package/cjs/types.js +2 -0
  302. package/cjs/uid.d.ts +2 -0
  303. package/cjs/uid.js +11 -0
  304. package/cjs/updateLinkParams.d.ts +3 -0
  305. package/cjs/updateLinkParams.js +11 -0
  306. package/cjs/updateUrlQueryParams.d.ts +3 -0
  307. package/cjs/updateUrlQueryParams.js +16 -0
  308. package/cjs/uppercase.d.ts +2 -0
  309. package/cjs/uppercase.js +8 -0
  310. package/cjs/uuid.d.ts +2 -0
  311. package/{uuid.mjs → cjs/uuid.js} +6 -8
  312. package/cjs/uuidNumeric.d.ts +2 -0
  313. package/cjs/uuidNumeric.js +6 -0
  314. package/cjs/wait.d.ts +2 -0
  315. package/cjs/wait.js +8 -0
  316. package/cjs/without.d.ts +0 -0
  317. package/cjs/without.js +1 -0
  318. package/clamp.d.ts +0 -6
  319. package/clamp.js +2 -12
  320. package/clsx.d.ts +4 -7
  321. package/clsx.js +2 -15
  322. package/convertRange.d.ts +0 -12
  323. package/convertRange.js +2 -18
  324. package/cookie.d.ts +0 -36
  325. package/cookie.js +1 -13
  326. package/createPalette.d.ts +0 -10
  327. package/createPalette.js +2 -16
  328. package/debounce.d.ts +0 -6
  329. package/debounce.js +2 -13
  330. package/debouncePromise.d.ts +10 -10
  331. package/debouncePromise.js +65 -12
  332. package/debounceRaf.d.ts +0 -7
  333. package/debounceRaf.js +2 -16
  334. package/decode.d.ts +0 -4
  335. package/decode.js +2 -10
  336. package/encode.d.ts +0 -4
  337. package/encode.js +2 -10
  338. package/ensureInt.d.ts +0 -5
  339. package/ensureInt.js +2 -11
  340. package/env.d.ts +0 -0
  341. package/env.js +0 -2
  342. package/errorToString.d.ts +0 -5
  343. package/errorToString.js +4 -14
  344. package/findDuplicatedIndexes.d.ts +0 -3
  345. package/findDuplicatedIndexes.js +2 -9
  346. package/forin.d.ts +0 -5
  347. package/forin.js +2 -11
  348. package/gbToBytes.d.ts +0 -5
  349. package/gbToBytes.js +2 -11
  350. package/getEmptyArray.d.ts +0 -7
  351. package/getEmptyArray.js +4 -16
  352. package/getKeys.d.ts +0 -7
  353. package/getKeys.js +2 -12
  354. package/getMediaQueryWidthResolvers.d.ts +0 -0
  355. package/getMediaQueryWidthResolvers.js +4 -36
  356. package/getMediaQueryWidthTailwindScreens.d.ts +1 -1
  357. package/getMediaQueryWidthTailwindScreens.js +4 -10
  358. package/getNonce.d.ts +0 -4
  359. package/getNonce.js +4 -12
  360. package/getParamAmong.d.ts +0 -10
  361. package/getParamAmong.js +4 -19
  362. package/getParamAsInt.d.ts +0 -10
  363. package/getParamAsInt.js +4 -19
  364. package/getParamAsString.d.ts +0 -9
  365. package/getParamAsString.js +4 -18
  366. package/getType.d.ts +0 -15
  367. package/getType.js +2 -21
  368. package/getUrlHashParams.d.ts +1 -7
  369. package/getUrlHashParams.js +2 -12
  370. package/getUrlHashPathname.d.ts +0 -7
  371. package/getUrlHashPathname.js +2 -13
  372. package/getUrlPathnameParts.d.ts +0 -10
  373. package/getUrlPathnameParts.js +4 -19
  374. package/getUrlQueryParams.d.ts +1 -12
  375. package/getUrlQueryParams.js +4 -22
  376. package/imgEmptyPixel.d.ts +0 -5
  377. package/imgEmptyPixel.js +2 -10
  378. package/index.d.ts +139 -134
  379. package/index.js +135 -267
  380. package/invariant.d.ts +0 -17
  381. package/invariant.js +3 -24
  382. package/isAnyObject.d.ts +1 -6
  383. package/isAnyObject.js +4 -14
  384. package/isArray.d.ts +0 -5
  385. package/isArray.js +4 -14
  386. package/isBlob.d.ts +0 -5
  387. package/isBlob.js +4 -14
  388. package/isBoolean.d.ts +0 -5
  389. package/isBoolean.js +4 -14
  390. package/isBrowser.d.ts +0 -4
  391. package/isBrowser.js +2 -9
  392. package/isBrowserNow.d.ts +0 -4
  393. package/isBrowserNow.js +3 -12
  394. package/isDate.d.ts +0 -5
  395. package/isDate.js +4 -14
  396. package/isEmptyArray.d.ts +0 -5
  397. package/isEmptyArray.js +4 -14
  398. package/isEmptyObject.d.ts +0 -5
  399. package/isEmptyObject.js +4 -14
  400. package/isEmptyString.d.ts +0 -5
  401. package/isEmptyString.js +2 -11
  402. package/isError.d.ts +0 -5
  403. package/isError.js +4 -14
  404. package/isExternalUrl.d.ts +0 -7
  405. package/isExternalUrl.js +4 -18
  406. package/isFile.d.ts +0 -5
  407. package/isFile.js +4 -14
  408. package/isFloat.d.ts +0 -5
  409. package/isFloat.js +4 -14
  410. package/isFormData.d.ts +0 -5
  411. package/isFormData.js +4 -14
  412. package/isFullArray.d.ts +0 -5
  413. package/isFullArray.js +4 -14
  414. package/isFullObject.d.ts +1 -6
  415. package/isFullObject.js +4 -14
  416. package/isFullString.d.ts +0 -5
  417. package/isFullString.js +4 -14
  418. package/isFunction.d.ts +1 -6
  419. package/isFunction.js +2 -11
  420. package/isInt.d.ts +0 -5
  421. package/isInt.js +4 -14
  422. package/isMap.d.ts +0 -5
  423. package/isMap.js +4 -14
  424. package/isNaNValue.d.ts +0 -5
  425. package/isNaNValue.js +4 -14
  426. package/isNegativeNumber.d.ts +0 -5
  427. package/isNegativeNumber.js +4 -14
  428. package/isNull.d.ts +0 -5
  429. package/isNull.js +4 -14
  430. package/isNullOrUndefined.d.ts +0 -5
  431. package/isNullOrUndefined.js +5 -14
  432. package/isNumber.d.ts +0 -7
  433. package/isNumber.js +4 -16
  434. package/isObject.d.ts +1 -6
  435. package/isObject.js +4 -14
  436. package/isObjectLike.d.ts +1 -8
  437. package/isObjectLike.js +4 -16
  438. package/isOneOf.d.ts +1 -4
  439. package/isOneOf.js +2 -6
  440. package/isPlainObject.d.ts +1 -6
  441. package/isPlainObject.js +4 -14
  442. package/isPositiveNumber.d.ts +0 -5
  443. package/isPositiveNumber.js +4 -14
  444. package/isPrimitive.d.ts +0 -5
  445. package/isPrimitive.js +14 -24
  446. package/isPromise.d.ts +0 -5
  447. package/isPromise.js +4 -14
  448. package/isRegExp.d.ts +0 -5
  449. package/isRegExp.js +4 -14
  450. package/isServer.d.ts +0 -4
  451. package/isServer.js +3 -12
  452. package/isServerNow.d.ts +0 -4
  453. package/isServerNow.js +3 -12
  454. package/isSet.d.ts +0 -5
  455. package/isSet.js +4 -14
  456. package/isString.d.ts +0 -5
  457. package/isString.js +4 -14
  458. package/isSymbol.d.ts +0 -5
  459. package/isSymbol.js +4 -14
  460. package/isType.d.ts +1 -9
  461. package/isType.js +4 -18
  462. package/isUndefined.d.ts +0 -5
  463. package/isUndefined.js +4 -14
  464. package/isWeakMap.d.ts +0 -5
  465. package/isWeakMap.js +4 -14
  466. package/isWeakSet.d.ts +0 -5
  467. package/isWeakSet.js +4 -14
  468. package/kbToBytes.d.ts +0 -5
  469. package/kbToBytes.js +2 -11
  470. package/location.d.ts +0 -3
  471. package/location.js +1 -2
  472. package/lowercase.d.ts +0 -5
  473. package/lowercase.js +2 -11
  474. package/mapListBy.d.ts +0 -5
  475. package/mapListBy.js +2 -11
  476. package/matchSorter.d.ts +0 -7
  477. package/matchSorter.js +9 -128
  478. package/mbToBytes.d.ts +0 -5
  479. package/mbToBytes.js +2 -11
  480. package/mergeObjects.d.ts +1 -7
  481. package/mergeObjects.js +11 -19
  482. package/mergeUrlQueryParams.d.ts +1 -7
  483. package/mergeUrlQueryParams.js +4 -15
  484. package/moveSortableArrayItemByKey.d.ts +0 -7
  485. package/moveSortableArrayItemByKey.js +5 -16
  486. package/noop.d.ts +0 -5
  487. package/noop.js +2 -11
  488. package/normaliseUrl.d.ts +0 -9
  489. package/normaliseUrl.js +4 -18
  490. package/normaliseUrlPathname.d.ts +0 -8
  491. package/normaliseUrlPathname.js +4 -17
  492. package/objectFlip.d.ts +2 -0
  493. package/objectFlip.js +11 -0
  494. package/objectOmit.d.ts +0 -9
  495. package/objectOmit.js +2 -15
  496. package/objectPick.d.ts +0 -6
  497. package/objectPick.js +2 -12
  498. package/objectToArray.d.ts +2 -0
  499. package/objectToArray.js +4 -0
  500. package/package.json +583 -11
  501. package/parseCookie.d.ts +1 -9
  502. package/parseCookie.js +2 -20
  503. package/parseURL.d.ts +0 -6
  504. package/parseURL.js +2 -12
  505. package/quaranteneProps.d.ts +0 -15
  506. package/quaranteneProps.js +2 -23
  507. package/randomInt.d.ts +0 -5
  508. package/randomInt.js +2 -11
  509. package/randomKey.d.ts +0 -6
  510. package/randomKey.js +2 -12
  511. package/readCookie.d.ts +0 -0
  512. package/readCookie.js +4 -8
  513. package/removeAccents.d.ts +1 -4
  514. package/removeAccents.js +6 -12
  515. package/removeCookie.d.ts +1 -8
  516. package/removeCookie.js +6 -17
  517. package/removeDuplicates.d.ts +0 -0
  518. package/removeDuplicates.js +0 -12
  519. package/removeDuplicatesByKey.d.ts +0 -6
  520. package/removeDuplicatesByKey.js +2 -12
  521. package/removeDuplicatesComparing.d.ts +0 -3
  522. package/removeDuplicatesComparing.js +6 -13
  523. package/removeIndexesFromArray.d.ts +0 -3
  524. package/removeIndexesFromArray.js +2 -10
  525. package/removeTrailingSlash.d.ts +0 -5
  526. package/removeTrailingSlash.js +2 -11
  527. package/removeUrlQueryParams.d.ts +0 -6
  528. package/removeUrlQueryParams.js +6 -17
  529. package/render.d.ts +0 -39
  530. package/render.js +4 -54
  531. package/round.d.ts +3 -0
  532. package/round.js +6 -0
  533. package/roundTo.d.ts +0 -6
  534. package/roundTo.js +3 -29
  535. package/serializeCookie.d.ts +1 -25
  536. package/serializeCookie.js +7 -45
  537. package/setCookie.d.ts +1 -8
  538. package/setCookie.js +11 -30
  539. package/shuffle.d.ts +0 -14
  540. package/shuffle.js +4 -22
  541. package/slugify.d.ts +0 -9
  542. package/slugify.js +11 -24
  543. package/split.d.ts +1 -1
  544. package/split.js +2 -8
  545. package/swapMap.d.ts +0 -5
  546. package/swapMap.js +2 -11
  547. package/throttle.d.ts +0 -6
  548. package/throttle.js +4 -14
  549. package/titleCase.d.ts +0 -5
  550. package/titleCase.js +2 -11
  551. package/toNumber.d.ts +0 -3
  552. package/toNumber.js +4 -11
  553. package/toRgba.d.ts +0 -3
  554. package/toRgba.js +2 -13
  555. package/transformToUrlPathname.d.ts +0 -9
  556. package/transformToUrlPathname.js +4 -18
  557. package/truncate.d.ts +0 -5
  558. package/truncate.js +2 -11
  559. package/tryUntil.d.ts +0 -6
  560. package/tryUntil.js +2 -18
  561. package/types.d.ts +0 -18
  562. package/types.js +1 -2
  563. package/typings.d.ts +1 -6
  564. package/uid.d.ts +0 -5
  565. package/uid.js +2 -11
  566. package/updateLinkParams.d.ts +1 -8
  567. package/updateLinkParams.js +4 -16
  568. package/updateUrlQueryParams.d.ts +1 -7
  569. package/updateUrlQueryParams.js +7 -18
  570. package/uppercase.d.ts +0 -5
  571. package/uppercase.js +2 -11
  572. package/uuid.d.ts +0 -6
  573. package/uuid.js +2 -12
  574. package/uuidNumeric.d.ts +0 -4
  575. package/uuidNumeric.js +2 -10
  576. package/wait.d.ts +0 -5
  577. package/wait.js +2 -11
  578. package/without.d.ts +0 -0
  579. package/without.js +0 -55
  580. package/Defer.mjs +0 -26
  581. package/README.md +0 -42
  582. package/addOrReplaceAtIdx.mjs +0 -19
  583. package/areEqual.mjs +0 -77
  584. package/arrayOfAll.mjs +0 -32
  585. package/arraySum.mjs +0 -9
  586. package/arrayToLookup.mjs +0 -13
  587. package/buildUrlQueryString.mjs +0 -31
  588. package/capitalize.mjs +0 -12
  589. package/changeUrlPath.mjs +0 -18
  590. package/chunkBySize.mjs +0 -12
  591. package/clamp.mjs +0 -10
  592. package/convertRange.mjs +0 -16
  593. package/cookie.mjs +0 -10
  594. package/createPalette.mjs +0 -22
  595. package/debouncePromise.mjs +0 -9
  596. package/debounceRaf.mjs +0 -27
  597. package/decode.mjs +0 -10
  598. package/encode.mjs +0 -10
  599. package/ensureInt.mjs +0 -9
  600. package/env.mjs +0 -3
  601. package/errorToString.mjs +0 -10
  602. package/findDuplicatedIndexes.mjs +0 -14
  603. package/forin.mjs +0 -11
  604. package/gbToBytes.mjs +0 -7
  605. package/getEmptyArray.mjs +0 -15
  606. package/getKeys.mjs +0 -9
  607. package/getNonce.mjs +0 -9
  608. package/getParamAmong.mjs +0 -17
  609. package/getParamAsInt.mjs +0 -20
  610. package/getParamAsString.mjs +0 -14
  611. package/getType.mjs +0 -19
  612. package/getUrlHashParams.mjs +0 -16
  613. package/getUrlHashPathname.mjs +0 -13
  614. package/getUrlPathnameParts.mjs +0 -20
  615. package/getUrlQueryParams.mjs +0 -38
  616. package/imgEmptyPixel.mjs +0 -7
  617. package/invariant.mjs +0 -34
  618. package/isAnyObject.mjs +0 -10
  619. package/isArray.mjs +0 -10
  620. package/isBlob.mjs +0 -10
  621. package/isBoolean.mjs +0 -10
  622. package/isBrowser.mjs +0 -6
  623. package/isBrowserNow.mjs +0 -7
  624. package/isDate.mjs +0 -10
  625. package/isEmptyArray.mjs +0 -10
  626. package/isEmptyObject.mjs +0 -10
  627. package/isEmptyString.mjs +0 -9
  628. package/isError.mjs +0 -10
  629. package/isExternalUrl.mjs +0 -21
  630. package/isFile.mjs +0 -10
  631. package/isFloat.mjs +0 -10
  632. package/isFormData.mjs +0 -10
  633. package/isFullArray.mjs +0 -10
  634. package/isFullObject.mjs +0 -10
  635. package/isFullString.mjs +0 -10
  636. package/isFunction.mjs +0 -9
  637. package/isInt.mjs +0 -10
  638. package/isMap.mjs +0 -10
  639. package/isNaNValue.mjs +0 -10
  640. package/isNegativeNumber.mjs +0 -10
  641. package/isNull.mjs +0 -10
  642. package/isNullOrUndefined.mjs +0 -10
  643. package/isNumber.mjs +0 -12
  644. package/isObject.mjs +0 -10
  645. package/isObjectLike.mjs +0 -12
  646. package/isOneOf.mjs +0 -10
  647. package/isPlainObject.mjs +0 -13
  648. package/isPositiveNumber.mjs +0 -10
  649. package/isPrimitive.mjs +0 -20
  650. package/isPromise.mjs +0 -10
  651. package/isRegExp.mjs +0 -10
  652. package/isServer.mjs +0 -8
  653. package/isServerNow.mjs +0 -7
  654. package/isSet.mjs +0 -10
  655. package/isString.mjs +0 -10
  656. package/isSymbol.mjs +0 -10
  657. package/isType.mjs +0 -22
  658. package/isUndefined.mjs +0 -10
  659. package/isWeakMap.mjs +0 -10
  660. package/isWeakSet.mjs +0 -10
  661. package/kbToBytes.mjs +0 -7
  662. package/location.mjs +0 -1
  663. package/lowercase.mjs +0 -9
  664. package/mapListBy.mjs +0 -14
  665. package/mbToBytes.mjs +0 -7
  666. package/mergeObjects.mjs +0 -37
  667. package/mergeUrlQueryParams.mjs +0 -22
  668. package/moveSortableArrayItemByKey.mjs +0 -17
  669. package/noop.mjs +0 -7
  670. package/normaliseUrl.mjs +0 -15
  671. package/normaliseUrlPathname.mjs +0 -14
  672. package/objectOmit.mjs +0 -19
  673. package/objectPick.mjs +0 -15
  674. package/quaranteneProps.mjs +0 -33
  675. package/randomInt.mjs +0 -9
  676. package/randomKey.mjs +0 -11
  677. package/removeAccents.mjs +0 -15
  678. package/removeCookie.mjs +0 -15
  679. package/removeDuplicates.mjs +0 -13
  680. package/removeDuplicatesComparing.mjs +0 -10
  681. package/removeIndexesFromArray.mjs +0 -14
  682. package/removeTrailingSlash.mjs +0 -10
  683. package/removeUrlQueryParams.mjs +0 -21
  684. package/roundTo.mjs +0 -34
  685. package/shuffle.mjs +0 -32
  686. package/slugify.mjs +0 -23
  687. package/split.mjs +0 -4
  688. package/swapMap.mjs +0 -14
  689. package/titleCase.mjs +0 -11
  690. package/toNumber.mjs +0 -8
  691. package/toRgba.mjs +0 -16
  692. package/transformToUrlPathname.mjs +0 -16
  693. package/truncate.mjs +0 -13
  694. package/tryUntil.mjs +0 -27
  695. package/types.mjs +0 -1
  696. package/uid.mjs +0 -12
  697. package/updateLinkParams.mjs +0 -14
  698. package/updateUrlQueryParams.mjs +0 -18
  699. package/uppercase.mjs +0 -9
  700. package/uuidNumeric.mjs +0 -6
  701. package/wait.mjs +0 -9
  702. package/without.mjs +0 -56
@@ -1,12 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.readCookie = void 0;
1
4
  function converterRead(value) {
2
5
  if (value[0] === '"') {
3
6
  value = value.slice(1, -1);
4
7
  }
5
8
  return value.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent);
6
9
  }
7
- export function readCookie(name) {
10
+ function readCookie(name) {
8
11
  if (typeof document === "undefined") {
9
- if (process.env["NODE_ENV"] !== "production") {
12
+ if (process.env["NODE_ENV"] === "development") {
10
13
  console.warn("[@koine/utils:readCookie] document is undefined");
11
14
  }
12
15
  return name ? "" : {};
@@ -24,11 +27,12 @@ export function readCookie(name) {
24
27
  }
25
28
  }
26
29
  catch (e) {
27
- if (process.env["NODE_ENV"] !== "production") {
30
+ if (process.env["NODE_ENV"] === "development") {
28
31
  console.warn("[@koine/utils:readCookie] failed to decode", value);
29
32
  }
30
33
  }
31
34
  }
32
35
  return name ? all[name] : all;
33
36
  }
34
- export default readCookie;
37
+ exports.readCookie = readCookie;
38
+ exports.default = readCookie;
@@ -0,0 +1,3 @@
1
+ import { type AccentsSet } from "./accentSets";
2
+ export declare function removeAccents(text?: string, sets?: AccentsSet[]): string;
3
+ export default removeAccents;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.removeAccents = void 0;
4
+ var tslib_1 = require("tslib");
5
+ var accentSets_1 = require("./accentSets");
6
+ function removeAccents(text, sets) {
7
+ if (text === void 0) { text = ""; }
8
+ if (sets === void 0) { sets = accentSets_1.accentsSets; }
9
+ var len = sets.length;
10
+ while (len--) {
11
+ var _a = tslib_1.__read(sets[len], 2), to = _a[0], from = _a[1];
12
+ text = text.replace(new RegExp("[".concat(from, "]"), "gi"), to);
13
+ }
14
+ return text;
15
+ }
16
+ exports.removeAccents = removeAccents;
17
+ exports.default = removeAccents;
@@ -0,0 +1,3 @@
1
+ import { type CookieAttributesClient } from "./cookie";
2
+ export declare function removeCookie(name: string, attributes?: CookieAttributesClient): void;
3
+ export default removeCookie;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.removeCookie = void 0;
4
+ var tslib_1 = require("tslib");
5
+ var cookie_1 = require("./cookie");
6
+ var setCookie_1 = require("./setCookie");
7
+ function removeCookie(name, attributes) {
8
+ if (attributes === void 0) { attributes = {}; }
9
+ (0, setCookie_1.setCookie)(name, "", tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, cookie_1.defaultAttributesClient), attributes), { expires: -1 }));
10
+ }
11
+ exports.removeCookie = removeCookie;
12
+ exports.default = removeCookie;
File without changes
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1,2 @@
1
+ export declare function removeDuplicatesByKey<T extends Record<string | number | symbol, any>>(array: T[] | undefined, key: keyof T): T[];
2
+ export default removeDuplicatesByKey;
@@ -1,10 +1,7 @@
1
- /**
2
- * Remove duplicated array objects, equality is determined by a strict (`===`)
3
- * comparison of each object's given key
4
- *
5
- * @category array
6
- */
7
- export function removeDuplicatesByKey(array, key) {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.removeDuplicatesByKey = void 0;
4
+ function removeDuplicatesByKey(array, key) {
8
5
  if (array === void 0) { array = []; }
9
6
  var keysMap = {};
10
7
  var output = [];
@@ -17,4 +14,5 @@ export function removeDuplicatesByKey(array, key) {
17
14
  }
18
15
  return output;
19
16
  }
20
- export default removeDuplicatesByKey;
17
+ exports.removeDuplicatesByKey = removeDuplicatesByKey;
18
+ exports.default = removeDuplicatesByKey;
@@ -0,0 +1,2 @@
1
+ export declare function removeDuplicatesComparing<T>(from: any[], to: T[]): T[];
2
+ export default removeDuplicatesComparing;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.removeDuplicatesComparing = void 0;
4
+ var findDuplicatedIndexes_1 = require("./findDuplicatedIndexes");
5
+ var removeIndexesFromArray_1 = require("./removeIndexesFromArray");
6
+ function removeDuplicatesComparing(from, to) {
7
+ var indexes = (0, findDuplicatedIndexes_1.findDuplicatedIndexes)(from);
8
+ return (0, removeIndexesFromArray_1.removeIndexesFromArray)(to, indexes);
9
+ }
10
+ exports.removeDuplicatesComparing = removeDuplicatesComparing;
11
+ exports.default = removeDuplicatesComparing;
@@ -0,0 +1,2 @@
1
+ export declare function removeIndexesFromArray<T>(arr: T[], indexes: Record<number, true>): T[];
2
+ export default removeIndexesFromArray;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.removeIndexesFromArray = void 0;
4
+ function removeIndexesFromArray(arr, indexes) {
5
+ var output = [];
6
+ for (var i = 0; i < arr.length; i++) {
7
+ if (!indexes.hasOwnProperty(i)) {
8
+ output.push(arr[i]);
9
+ }
10
+ }
11
+ return output;
12
+ }
13
+ exports.removeIndexesFromArray = removeIndexesFromArray;
14
+ exports.default = removeIndexesFromArray;
@@ -0,0 +1,2 @@
1
+ export declare function removeTralingSlash(urlLike?: string): string;
2
+ export default removeTralingSlash;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.removeTralingSlash = void 0;
4
+ function removeTralingSlash(urlLike) {
5
+ if (urlLike === void 0) { urlLike = ""; }
6
+ return urlLike.replace(/\/*$/, "");
7
+ }
8
+ exports.removeTralingSlash = removeTralingSlash;
9
+ exports.default = removeTralingSlash;
@@ -0,0 +1,2 @@
1
+ export declare function removeUrlQueryParams(url: string, paramsToRemove?: string[]): string;
2
+ export default removeUrlQueryParams;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.removeUrlQueryParams = void 0;
4
+ var buildUrlQueryString_1 = require("./buildUrlQueryString");
5
+ var getUrlQueryParams_1 = require("./getUrlQueryParams");
6
+ function removeUrlQueryParams(url, paramsToRemove) {
7
+ if (paramsToRemove === void 0) { paramsToRemove = []; }
8
+ var parts = url.split("?");
9
+ var allParams = (0, getUrlQueryParams_1.default)(url);
10
+ var params = {};
11
+ for (var key in allParams) {
12
+ if (!paramsToRemove.includes(key)) {
13
+ params[key] = allParams[key];
14
+ }
15
+ }
16
+ return parts[0] + (0, buildUrlQueryString_1.default)(params);
17
+ }
18
+ exports.removeUrlQueryParams = removeUrlQueryParams;
19
+ exports.default = removeUrlQueryParams;
@@ -0,0 +1,13 @@
1
+ type DefinitionExtended = {
2
+ __exp?: {
3
+ [key: string]: number | boolean | string;
4
+ };
5
+ arg: string;
6
+ text: string;
7
+ };
8
+ type Definitions = {
9
+ [key: string]: DefinitionExtended;
10
+ } & DefinitionExtended;
11
+ type RenderFunction = (data: object) => string;
12
+ export declare const render: (tmpl: string, def?: Definitions) => RenderFunction;
13
+ export default render;
@@ -1,16 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.render = void 0;
1
4
  var varname = "data";
2
5
  var evaluate = /<%([\s\S]+?(\}?)+)%>/g;
3
6
  var interpolate = /<%=([\s\S]+?)%>/g;
4
7
  var conditional = /<%\?(\?)?\s*([\s\S]*?)\s*%>/g;
5
8
  var iterate = /<%~\s*(?:%>|([\s\S]+?)\s*:\s*([\w$]+)\s*(?::\s*([\w$]+))?\s*%>)/g;
6
- // const encode = /<%!([\s\S]+?)%>/g;
7
9
  var use = /<%#([\s\S]+?)%>/g;
8
10
  var useParams = /(^|[^\w$])def(?:\.|\[['"])([\w$.]+)(?:['"]\])?\s*:\s*([\w$.]+|"[^"]+"|'[^']+'|\{[^}]+\})/g;
9
11
  var define = /<%##\s*([\w.$]+)\s*(:|=)([\s\S]+?)#%>/g;
10
12
  var defineParams = /^\s*([\w$]+):([\s\S]+)/;
11
13
  var start = "'+(";
12
14
  var end = ")+'";
13
- // const startencode = "'+encodeHTML(";
14
15
  var skip = /$^/;
15
16
  var resolveDefs = function (block, def) {
16
17
  return (typeof block === "string" ? block : block.toString())
@@ -20,12 +21,9 @@ var resolveDefs = function (block, def) {
20
21
  }
21
22
  if (!(code in def)) {
22
23
  if (assign === ":") {
23
- value.replace(defineParams,
24
- // @ts-expect-error nevermind
25
- function (_, param, v) {
24
+ value.replace(defineParams, function (_, param, v) {
26
25
  def[code] = { arg: param, text: v };
27
26
  });
28
- // @ts-expect-error nevermind
29
27
  if (!(code in def))
30
28
  def[code] = value;
31
29
  }
@@ -52,43 +50,7 @@ var resolveDefs = function (block, def) {
52
50
  var unescape = function (code) {
53
51
  return code.replace(/\\('|\\)/g, "$1").replace(/[\r\t\n]/g, " ");
54
52
  };
55
- /**
56
- * Render template (adapted from doT.js)
57
- *
58
- * The data made available to the template is always on the `data` key, e.g.:
59
- * `renderer({ myVal: "xx" })`
60
- * ... will be accessible on
61
- * `<%= data.myVal %>`
62
- *
63
- * The default delimiters are customised to work without conflicts with Blade and Twig:
64
- * ```
65
- * <% %> for evaluation
66
- * <%= %> for interpolation
67
- * <%? %> for conditionals
68
- * <%~ %> for array iteration
69
- * <%# %> for compile-time evaluation/includes and partials
70
- * <%## #%> for compile-time defines
71
- *
72
- * Unsupported:
73
- * <%! %> for interpolation with encoding
74
- * ```
75
- *
76
- * @example
77
- *
78
- * ```js
79
- * import { render } from "...";
80
- *
81
- * const data = { name: "XYZ" };
82
- * const tpl = `Hello <%= data.name %>`;
83
- * const renderer = render(tpl);
84
- *
85
- * console.log(renderer(data)); // outputs 'Hello XYZ'
86
- * ```
87
- *
88
- * @borrows [olado/doT by Laura Doktorova](https://github.com/olado/doT)
89
- * @see https://olado.github.io/doT/index.html
90
- */
91
- export var render = function (tmpl, def) {
53
+ var render = function (tmpl, def) {
92
54
  var sid = 0;
93
55
  var indv;
94
56
  var str = use || define ? resolveDefs(tmpl, def || {}) : tmpl;
@@ -98,10 +60,6 @@ export var render = function (tmpl, def) {
98
60
  .replace(/\r|\n|\t|\/\*[\s\S]*?\*\//g, "")
99
61
  .replace(/'|\\/g, "\\$&")
100
62
  .replace(interpolate || skip, function (_, code) { return start + unescape(code) + end; })
101
- // .replace(
102
- // encode || skip,
103
- // (_, code) => cse.startencode + unescape(code) + cse.end
104
- // )
105
63
  .replace(conditional || skip, function (_, elseCase, code) {
106
64
  return elseCase
107
65
  ? code
@@ -150,16 +108,16 @@ export var render = function (tmpl, def) {
150
108
  .replace(/\r/g, "\\r")
151
109
  .replace(/(\s|;|\}|^|\{)X\+='';/g, "$1")
152
110
  .replace(/\+''/g, "");
153
- //.replace(/(\s|;|\}|^|\{)X\+=''\+/g,'$1X+=');
154
111
  try {
155
112
  return new Function(varname, str);
156
113
  }
157
114
  catch (e) {
158
- if (process.env["NODE_ENV"] !== "production") {
115
+ if (process.env["NODE_ENV"] === "development") {
159
116
  console.log("Could not create a template function: " + str);
160
117
  throw e;
161
118
  }
162
119
  }
163
120
  return function () { return ""; };
164
121
  };
165
- export default render;
122
+ exports.render = render;
123
+ exports.default = exports.render;
package/cjs/round.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ import type { AnythingFalsy } from "./types";
2
+ export declare const round: (number: number, decimals?: AnythingFalsy | number, trailingZeroes?: 1 | boolean | AnythingFalsy) => number;
3
+ export default round;
package/cjs/round.js ADDED
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.round = void 0;
4
+ var round = function (number, decimals, trailingZeroes) {
5
+ return decimals
6
+ ? parseFloat(number.toFixed(decimals).replace(trailingZeroes ? "" : /\.+0*$/, ""))
7
+ : parseInt(number + "", 10);
8
+ };
9
+ exports.round = round;
10
+ exports.default = exports.round;
@@ -0,0 +1,2 @@
1
+ export declare function roundTo(num: number, decimals?: number): string;
2
+ export default roundTo;
package/cjs/roundTo.js ADDED
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.roundTo = void 0;
4
+ function roundTo(num, decimals) {
5
+ if (decimals === void 0) { decimals = 2; }
6
+ if (isFinite(num) && !isNaN(num)) {
7
+ var multiplicator = Math.pow(10, decimals);
8
+ return Math.round(num * multiplicator) / multiplicator + "";
9
+ }
10
+ if (process.env["NODE_ENV"] === "development") {
11
+ console.warn("[@koine/utils] math:roundTo -> given not a finite number as first arg");
12
+ }
13
+ return "";
14
+ }
15
+ exports.roundTo = roundTo;
16
+ exports.default = roundTo;
@@ -0,0 +1,3 @@
1
+ import { type CookieAttributesServer } from "./cookie";
2
+ export declare function serializeCookie(name: string, val: string, attributes?: CookieAttributesServer): string;
3
+ export default serializeCookie;
@@ -1,43 +1,14 @@
1
- /**
2
- * @file
3
- *
4
- * @category cookie
5
- *
6
- * All cookie related code is inspired and adapted from:
7
- * - [js-cookie](https://github.com/js-cookie/js-cookie)
8
- * - [cookie](https://github.com/jshttp/cookie)
9
- */
10
- import { isNumber } from "./isNumber";
11
- /**
12
- * RegExp to match field-content in RFC 7230 sec 3.2
13
- *
14
- * field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ]
15
- * field-vchar = VCHAR / obs-text
16
- * obs-text = %x80-FF
17
- */
18
- // eslint-disable-next-line no-control-regex
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.serializeCookie = void 0;
4
+ var isNumber_1 = require("./isNumber");
19
5
  var fieldContentRegExp = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;
20
- /**
21
- * Serialize data into a cookie header.
22
- *
23
- * Serialize the a name value pair into a cookie string suitable for
24
- * http headers. An optional attributes object specified cookie parameters.
25
- *
26
- * serialize('foo', 'bar', { httpOnly: true })
27
- * => "foo=bar; httpOnly"
28
- *
29
- * @category cookie
30
- *
31
- * All cookie related code is inspired and adapted from:
32
- * - [js-cookie](https://github.com/js-cookie/js-cookie)
33
- * - [cookie](https://github.com/jshttp/cookie)
34
- */
35
- export function serializeCookie(name, val, attributes) {
6
+ function serializeCookie(name, val, attributes) {
36
7
  if (attributes === void 0) { attributes = {}; }
37
8
  var _a = attributes.encode, encode = _a === void 0 ? encodeURIComponent : _a, domain = attributes.domain, path = attributes.path, httpOnly = attributes.httpOnly, secure = attributes.secure, sameSite = attributes.sameSite;
38
9
  var maxAge = attributes.maxAge, expires = attributes.expires;
39
10
  var value = encode(val);
40
- if (process.env["NODE_ENV"] !== "production") {
11
+ if (process.env["NODE_ENV"] === "development") {
41
12
  if (!fieldContentRegExp.test(name)) {
42
13
  throw new TypeError("argument name is invalid");
43
14
  }
@@ -57,7 +28,7 @@ export function serializeCookie(name, val, attributes) {
57
28
  str += "; Max-Age=" + Math.floor(maxAge);
58
29
  }
59
30
  if (domain) {
60
- if (process.env["NODE_ENV"] !== "production") {
31
+ if (process.env["NODE_ENV"] === "development") {
61
32
  if (!fieldContentRegExp.test(domain)) {
62
33
  throw new TypeError("option domain is invalid");
63
34
  }
@@ -65,7 +36,7 @@ export function serializeCookie(name, val, attributes) {
65
36
  str += "; Domain=" + domain;
66
37
  }
67
38
  if (path) {
68
- if (process.env["NODE_ENV"] !== "production") {
39
+ if (process.env["NODE_ENV"] === "development") {
69
40
  if (!fieldContentRegExp.test(path)) {
70
41
  throw new TypeError("option path is invalid");
71
42
  }
@@ -73,7 +44,7 @@ export function serializeCookie(name, val, attributes) {
73
44
  str += "; Path=" + path;
74
45
  }
75
46
  if (expires) {
76
- if (isNumber(expires)) {
47
+ if ((0, isNumber_1.isNumber)(expires)) {
77
48
  expires = new Date(Date.now() + expires * 864e5);
78
49
  }
79
50
  str += "; Expires=" + expires.toUTCString();
@@ -95,10 +66,9 @@ export function serializeCookie(name, val, attributes) {
95
66
  case "none":
96
67
  str += "; SameSite=None";
97
68
  break;
98
- // default:
99
- // throw new TypeError('option sameSite is invalid');
100
69
  }
101
70
  }
102
71
  return str;
103
72
  }
104
- export default serializeCookie;
73
+ exports.serializeCookie = serializeCookie;
74
+ exports.default = serializeCookie;
@@ -0,0 +1,3 @@
1
+ import { type CookieAttributesClient } from "./cookie";
2
+ export declare function setCookie<T extends string = string>(name: string, value: string | T, attributes?: CookieAttributesClient): string | undefined;
3
+ export default setCookie;
@@ -1,29 +1,24 @@
1
- import { __assign, __rest } from "tslib";
2
- import { defaultAttributesClient } from "./cookie";
3
- import isNumber from "./isNumber";
4
- import isUndefined from "./isUndefined";
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.setCookie = void 0;
4
+ var tslib_1 = require("tslib");
5
+ var cookie_1 = require("./cookie");
6
+ var isNumber_1 = require("./isNumber");
7
+ var isUndefined_1 = require("./isUndefined");
5
8
  function converterWrite(value) {
6
9
  return encodeURIComponent(value).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g, decodeURIComponent);
7
10
  }
8
- /**
9
- * @category cookie
10
- *
11
- * All cookie related code is inspired and adapted from:
12
- * - [js-cookie](https://github.com/js-cookie/js-cookie)
13
- * - [cookie](https://github.com/jshttp/cookie)
14
- */
15
- export function setCookie(name, value, attributes) {
11
+ function setCookie(name, value, attributes) {
16
12
  if (attributes === void 0) { attributes = {}; }
17
- // eslint-disable-next-line prefer-const
18
- var expires = attributes.expires, restAttrs = __rest(attributes, ["expires"]);
19
- var cleanedAttrs = __assign(__assign({ expires: "" }, defaultAttributesClient), restAttrs);
20
- if (isUndefined(document)) {
21
- if (process.env["NODE_ENV"] !== "production") {
13
+ var expires = attributes.expires, restAttrs = tslib_1.__rest(attributes, ["expires"]);
14
+ var cleanedAttrs = tslib_1.__assign(tslib_1.__assign({ expires: "" }, cookie_1.defaultAttributesClient), restAttrs);
15
+ if ((0, isUndefined_1.default)(document)) {
16
+ if (process.env["NODE_ENV"] === "development") {
22
17
  console.warn("[@koine/utils:setCookie] document is undefined");
23
18
  }
24
19
  return undefined;
25
20
  }
26
- if (isNumber(expires)) {
21
+ if ((0, isNumber_1.default)(expires)) {
27
22
  expires = new Date(Date.now() + expires * 864e5);
28
23
  }
29
24
  if (expires) {
@@ -42,17 +37,11 @@ export function setCookie(name, value, attributes) {
42
37
  if (attributes[attrName] === true) {
43
38
  continue;
44
39
  }
45
- // Considers RFC 6265 section 5.2:
46
- // ...
47
- // 3. If the remaining unparsed-attributes contains a %x3B (";")
48
- // character:
49
- // Consume the characters of the unparsed-attributes up to,
50
- // not including, the first %x3B (";") character.
51
- // ...
52
40
  stringifiedAttributes +=
53
41
  "=" + String(attributes[attrName]).split(";")[0];
54
42
  }
55
43
  return (document.cookie =
56
44
  name + "=" + converterWrite(value) + stringifiedAttributes);
57
45
  }
58
- export default setCookie;
46
+ exports.setCookie = setCookie;
47
+ exports.default = setCookie;
@@ -0,0 +1,2 @@
1
+ export declare function shuffle<T>(array: T[]): T[];
2
+ export default shuffle;
package/cjs/shuffle.js ADDED
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.shuffle = void 0;
4
+ var tslib_1 = require("tslib");
5
+ function shuffle(array) {
6
+ var length = array == null ? 0 : array.length;
7
+ if (!length) {
8
+ return [];
9
+ }
10
+ var index = -1;
11
+ var lastIndex = length - 1;
12
+ var result = tslib_1.__spreadArray([], tslib_1.__read(array), false);
13
+ while (++index < length) {
14
+ var rand = index + Math.floor(Math.random() * (lastIndex - index + 1));
15
+ var value = result[rand];
16
+ result[rand] = result[index];
17
+ result[index] = value;
18
+ }
19
+ return result;
20
+ }
21
+ exports.shuffle = shuffle;
22
+ exports.default = shuffle;
@@ -0,0 +1,2 @@
1
+ export declare function slugify(text: string, separator?: string): string;
2
+ export default slugify;
package/cjs/slugify.js ADDED
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.slugify = void 0;
4
+ var accentSets_1 = require("./accentSets");
5
+ var removeAccents_1 = require("./removeAccents");
6
+ function slugify(text, separator) {
7
+ if (separator === void 0) { separator = "-"; }
8
+ return (0, removeAccents_1.removeAccents)(text.toString().toLowerCase().trim(), accentSets_1.accentsSets.concat([["-", "[·/_,:;']"]]))
9
+ .replace(/\s+/g, "-")
10
+ .replace(/&/g, "-and-")
11
+ .replace(/[^\w-]+/g, "")
12
+ .replace(/--+/g, "-")
13
+ .replace(/^-+/, "")
14
+ .replace(/-+$/, "")
15
+ .replace(/-/g, separator);
16
+ }
17
+ exports.slugify = slugify;
18
+ exports.default = slugify;
package/cjs/split.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ export type Split<S extends string, D extends string> = string extends S ? string[] : S extends "" ? [] : S extends `${infer T}${D}${infer U}` ? [T, ...Split<U, D>] : [S];
2
+ export declare const split: <T extends string, D extends string>(string: T, delimiter: D) => Split<T, D>;
3
+ export default split;
package/cjs/split.js ADDED
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.split = void 0;
4
+ var split = function (string, delimiter) { return string.split(delimiter); };
5
+ exports.split = split;
6
+ exports.default = exports.split;
@@ -0,0 +1,2 @@
1
+ export declare function swapMap<T extends Record<string, string | number | symbol> = Record<string, string | number | symbol>>(map?: T): Record<T[keyof T], keyof T>;
2
+ export default swapMap;
package/cjs/swapMap.js ADDED
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.swapMap = void 0;
4
+ function swapMap(map) {
5
+ if (map === void 0) { map = {}; }
6
+ var output = {};
7
+ for (var key in map) {
8
+ output[map[key]] = key;
9
+ }
10
+ return output;
11
+ }
12
+ exports.swapMap = swapMap;
13
+ exports.default = swapMap;
@@ -0,0 +1,2 @@
1
+ export declare function throttle<TFn extends Function, TContext>(fn: TFn, limit: number, context?: TContext): (this: TContext, ...args: any[]) => NodeJS.Timeout | undefined;
2
+ export default throttle;
@@ -1,11 +1,8 @@
1
- import { __spreadArray } from "tslib";
2
- /**
3
- * Throttle function (e.g. for resize / scroll handlers)
4
- *
5
- * @category function
6
- * @see https://github.com/Mobius1/Rangeable/
7
- */
8
- export function throttle(fn, limit, context) {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.throttle = void 0;
4
+ var tslib_1 = require("tslib");
5
+ function throttle(fn, limit, context) {
9
6
  var wait;
10
7
  return function () {
11
8
  var args = [];
@@ -14,7 +11,7 @@ export function throttle(fn, limit, context) {
14
11
  }
15
12
  context = context || this;
16
13
  if (!wait) {
17
- fn.apply.apply(fn, __spreadArray([context], args, false));
14
+ fn.apply.apply(fn, tslib_1.__spreadArray([context], tslib_1.__read(args), false));
18
15
  wait = true;
19
16
  return setTimeout(function () {
20
17
  wait = false;
@@ -23,4 +20,5 @@ export function throttle(fn, limit, context) {
23
20
  return;
24
21
  };
25
22
  }
26
- export default throttle;
23
+ exports.throttle = throttle;
24
+ exports.default = throttle;
@@ -0,0 +1,2 @@
1
+ export declare const titleCase: (input?: null | string) => string;
2
+ export default titleCase;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.titleCase = void 0;
4
+ var titleCase = function (input) {
5
+ return input
6
+ ? input.replace(/\w\S*/g, function (txt) { return txt.charAt(0).toUpperCase() + txt.substring(1).toLowerCase(); })
7
+ : "";
8
+ };
9
+ exports.titleCase = titleCase;
10
+ exports.default = exports.titleCase;