@koine/utils 2.0.0-beta.13 → 2.0.0-beta.15

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 (697) hide show
  1. package/Defer.d.ts +0 -14
  2. package/Defer.js +11 -0
  3. package/Emitter.d.ts +0 -20
  4. package/Emitter.js +20 -0
  5. package/accentSets.d.ts +0 -14
  6. package/accentSets.js +30 -0
  7. package/addOrReplaceAtIdx.d.ts +0 -7
  8. package/addOrReplaceAtIdx.js +16 -0
  9. package/areEqual.d.ts +0 -15
  10. package/areEqual.js +55 -0
  11. package/arrayOfAll.d.ts +0 -25
  12. package/arrayOfAll.js +6 -0
  13. package/arraySum.d.ts +0 -6
  14. package/arraySum.js +4 -0
  15. package/arrayToLookup.d.ts +0 -5
  16. package/arrayToLookup.js +8 -0
  17. package/buildUrlQueryString.d.ts +1 -10
  18. package/buildUrlQueryString.js +21 -0
  19. package/capitalize.d.ts +0 -7
  20. package/capitalize.js +6 -0
  21. package/changeUrlPath.d.ts +0 -8
  22. package/changeUrlPath.js +10 -0
  23. package/chunkByChunks.d.ts +0 -5
  24. package/chunkByChunks.js +32 -0
  25. package/chunkBySize.d.ts +0 -4
  26. package/chunkBySize.js +8 -0
  27. package/cjs/Defer.d.ts +6 -0
  28. package/cjs/Defer.js +15 -0
  29. package/cjs/Emitter.d.ts +7 -0
  30. package/cjs/Emitter.js +24 -0
  31. package/cjs/accentSets.d.ts +3 -0
  32. package/cjs/accentSets.js +33 -0
  33. package/cjs/addOrReplaceAtIdx.d.ts +2 -0
  34. package/cjs/addOrReplaceAtIdx.js +20 -0
  35. package/cjs/areEqual.d.ts +4 -0
  36. package/cjs/areEqual.js +59 -0
  37. package/cjs/arrayOfAll.d.ts +2 -0
  38. package/cjs/arrayOfAll.js +10 -0
  39. package/cjs/arraySum.d.ts +2 -0
  40. package/cjs/arraySum.js +8 -0
  41. package/cjs/arrayToLookup.d.ts +2 -0
  42. package/cjs/arrayToLookup.js +12 -0
  43. package/cjs/buildUrlQueryString.d.ts +3 -0
  44. package/cjs/buildUrlQueryString.js +25 -0
  45. package/cjs/capitalize.d.ts +2 -0
  46. package/cjs/capitalize.js +10 -0
  47. package/cjs/changeUrlPath.d.ts +2 -0
  48. package/cjs/changeUrlPath.js +14 -0
  49. package/cjs/chunkByChunks.d.ts +2 -0
  50. package/cjs/chunkByChunks.js +36 -0
  51. package/cjs/chunkBySize.d.ts +2 -0
  52. package/cjs/chunkBySize.js +12 -0
  53. package/cjs/clamp.d.ts +2 -0
  54. package/cjs/clamp.js +8 -0
  55. package/cjs/clsx.d.ts +6 -0
  56. package/cjs/clsx.js +44 -0
  57. package/cjs/convertRange.d.ts +2 -0
  58. package/cjs/convertRange.js +8 -0
  59. package/cjs/cookie.d.ts +18 -0
  60. package/cjs/cookie.js +4 -0
  61. package/cjs/createPalette.d.ts +10 -0
  62. package/cjs/createPalette.js +16 -0
  63. package/cjs/debounce.d.ts +2 -0
  64. package/cjs/debounce.js +26 -0
  65. package/cjs/debouncePromise.d.ts +11 -0
  66. package/cjs/debouncePromise.js +69 -0
  67. package/cjs/debounceRaf.d.ts +2 -0
  68. package/cjs/debounceRaf.js +21 -0
  69. package/cjs/decode.d.ts +2 -0
  70. package/cjs/decode.js +10 -0
  71. package/cjs/encode.d.ts +2 -0
  72. package/cjs/encode.js +10 -0
  73. package/cjs/ensureInt.d.ts +2 -0
  74. package/cjs/ensureInt.js +8 -0
  75. package/cjs/env.d.ts +0 -0
  76. package/cjs/env.js +1 -0
  77. package/cjs/errorToString.d.ts +2 -0
  78. package/cjs/errorToString.js +9 -0
  79. package/cjs/findDuplicatedIndexes.d.ts +2 -0
  80. package/cjs/findDuplicatedIndexes.js +15 -0
  81. package/cjs/forin.d.ts +2 -0
  82. package/cjs/forin.js +10 -0
  83. package/cjs/gbToBytes.d.ts +2 -0
  84. package/cjs/gbToBytes.js +6 -0
  85. package/cjs/getEmptyArray.d.ts +2 -0
  86. package/cjs/getEmptyArray.js +12 -0
  87. package/cjs/getKeys.d.ts +2 -0
  88. package/cjs/getKeys.js +5 -0
  89. package/cjs/getMediaQueryWidthResolvers.d.ts +10 -0
  90. package/cjs/getMediaQueryWidthResolvers.js +44 -0
  91. package/cjs/getMediaQueryWidthTailwindScreens.d.ts +5 -0
  92. package/cjs/getMediaQueryWidthTailwindScreens.js +31 -0
  93. package/cjs/getNonce.d.ts +2 -0
  94. package/cjs/getNonce.js +9 -0
  95. package/cjs/getParamAmong.d.ts +2 -0
  96. package/cjs/getParamAmong.js +11 -0
  97. package/cjs/getParamAsInt.d.ts +2 -0
  98. package/cjs/getParamAsInt.js +14 -0
  99. package/cjs/getParamAsString.d.ts +2 -0
  100. package/cjs/getParamAsString.js +9 -0
  101. package/cjs/getType.d.ts +7 -0
  102. package/cjs/getType.js +8 -0
  103. package/cjs/getUrlHashParams.d.ts +3 -0
  104. package/cjs/getUrlHashParams.js +14 -0
  105. package/cjs/getUrlHashPathname.d.ts +2 -0
  106. package/cjs/getUrlHashPathname.js +10 -0
  107. package/cjs/getUrlPathnameParts.d.ts +2 -0
  108. package/cjs/getUrlPathnameParts.js +14 -0
  109. package/cjs/getUrlQueryParams.d.ts +3 -0
  110. package/cjs/getUrlQueryParams.js +29 -0
  111. package/cjs/imgEmptyPixel.d.ts +2 -0
  112. package/cjs/imgEmptyPixel.js +5 -0
  113. package/{index.mjs → cjs/index.d.ts} +9 -7
  114. package/cjs/index.js +265 -0
  115. package/cjs/invariant.d.ts +2 -0
  116. package/cjs/invariant.js +21 -0
  117. package/cjs/isAnyObject.d.ts +3 -0
  118. package/cjs/isAnyObject.js +9 -0
  119. package/cjs/isArray.d.ts +2 -0
  120. package/cjs/isArray.js +9 -0
  121. package/cjs/isBlob.d.ts +2 -0
  122. package/cjs/isBlob.js +9 -0
  123. package/cjs/isBoolean.d.ts +2 -0
  124. package/cjs/isBoolean.js +9 -0
  125. package/cjs/isBrowser.d.ts +2 -0
  126. package/cjs/isBrowser.js +5 -0
  127. package/cjs/isBrowserNow.d.ts +2 -0
  128. package/cjs/isBrowserNow.js +7 -0
  129. package/cjs/isDate.d.ts +2 -0
  130. package/cjs/isDate.js +9 -0
  131. package/cjs/isEmptyArray.d.ts +2 -0
  132. package/cjs/isEmptyArray.js +9 -0
  133. package/cjs/isEmptyObject.d.ts +4 -0
  134. package/cjs/isEmptyObject.js +9 -0
  135. package/cjs/isEmptyString.d.ts +2 -0
  136. package/cjs/isEmptyString.js +8 -0
  137. package/cjs/isError.d.ts +2 -0
  138. package/cjs/isError.js +9 -0
  139. package/cjs/isExternalUrl.d.ts +2 -0
  140. package/cjs/isExternalUrl.js +16 -0
  141. package/cjs/isFile.d.ts +2 -0
  142. package/cjs/isFile.js +9 -0
  143. package/cjs/isFloat.d.ts +2 -0
  144. package/cjs/isFloat.js +9 -0
  145. package/cjs/isFormData.d.ts +2 -0
  146. package/cjs/isFormData.js +9 -0
  147. package/cjs/isFullArray.d.ts +2 -0
  148. package/cjs/isFullArray.js +9 -0
  149. package/cjs/isFullObject.d.ts +3 -0
  150. package/cjs/isFullObject.js +9 -0
  151. package/cjs/isFullString.d.ts +2 -0
  152. package/cjs/isFullString.js +9 -0
  153. package/cjs/isFunction.d.ts +3 -0
  154. package/cjs/isFunction.js +8 -0
  155. package/cjs/isInt.d.ts +2 -0
  156. package/cjs/isInt.js +9 -0
  157. package/cjs/isMap.d.ts +2 -0
  158. package/cjs/isMap.js +9 -0
  159. package/cjs/isNaNValue.d.ts +2 -0
  160. package/cjs/isNaNValue.js +9 -0
  161. package/cjs/isNegativeNumber.d.ts +2 -0
  162. package/cjs/isNegativeNumber.js +9 -0
  163. package/cjs/isNull.d.ts +2 -0
  164. package/cjs/isNull.js +9 -0
  165. package/cjs/isNullOrUndefined.d.ts +2 -0
  166. package/cjs/isNullOrUndefined.js +8 -0
  167. package/cjs/isNumber.d.ts +2 -0
  168. package/cjs/isNumber.js +9 -0
  169. package/cjs/isObject.d.ts +3 -0
  170. package/cjs/isObject.js +9 -0
  171. package/cjs/isObjectLike.d.ts +3 -0
  172. package/cjs/isObjectLike.js +9 -0
  173. package/cjs/isOneOf.d.ts +6 -0
  174. package/cjs/isOneOf.js +14 -0
  175. package/cjs/isPlainObject.d.ts +3 -0
  176. package/cjs/isPlainObject.js +12 -0
  177. package/cjs/isPositiveNumber.d.ts +2 -0
  178. package/cjs/isPositiveNumber.js +9 -0
  179. package/cjs/isPrimitive.d.ts +2 -0
  180. package/cjs/isPrimitive.js +19 -0
  181. package/cjs/isPromise.d.ts +2 -0
  182. package/cjs/isPromise.js +9 -0
  183. package/cjs/isRegExp.d.ts +2 -0
  184. package/cjs/isRegExp.js +9 -0
  185. package/cjs/isServer.d.ts +2 -0
  186. package/cjs/isServer.js +6 -0
  187. package/cjs/isServerNow.d.ts +2 -0
  188. package/cjs/isServerNow.js +7 -0
  189. package/cjs/isSet.d.ts +2 -0
  190. package/cjs/isSet.js +9 -0
  191. package/cjs/isString.d.ts +2 -0
  192. package/cjs/isString.js +9 -0
  193. package/cjs/isSymbol.d.ts +2 -0
  194. package/cjs/isSymbol.js +9 -0
  195. package/cjs/isType.d.ts +3 -0
  196. package/cjs/isType.js +17 -0
  197. package/cjs/isUndefined.d.ts +2 -0
  198. package/cjs/isUndefined.js +9 -0
  199. package/cjs/isWeakMap.d.ts +2 -0
  200. package/cjs/isWeakMap.js +9 -0
  201. package/cjs/isWeakSet.d.ts +2 -0
  202. package/cjs/isWeakSet.js +9 -0
  203. package/cjs/kbToBytes.d.ts +2 -0
  204. package/cjs/kbToBytes.js +6 -0
  205. package/cjs/location.d.ts +1 -0
  206. package/cjs/location.js +2 -0
  207. package/cjs/lowercase.d.ts +2 -0
  208. package/cjs/lowercase.js +8 -0
  209. package/cjs/mapListBy.d.ts +2 -0
  210. package/cjs/mapListBy.js +13 -0
  211. package/cjs/matchSorter.d.ts +54 -0
  212. package/cjs/matchSorter.js +259 -0
  213. package/cjs/mbToBytes.d.ts +2 -0
  214. package/cjs/mbToBytes.js +6 -0
  215. package/cjs/mergeObjects.d.ts +1 -0
  216. package/cjs/mergeObjects.js +37 -0
  217. package/cjs/mergeUrlQueryParams.d.ts +3 -0
  218. package/cjs/mergeUrlQueryParams.js +20 -0
  219. package/cjs/moveSortableArrayItemByKey.d.ts +2 -0
  220. package/cjs/moveSortableArrayItemByKey.js +14 -0
  221. package/cjs/noop.d.ts +2 -0
  222. package/cjs/noop.js +6 -0
  223. package/cjs/normaliseUrl.d.ts +2 -0
  224. package/cjs/normaliseUrl.js +10 -0
  225. package/cjs/normaliseUrlPathname.d.ts +2 -0
  226. package/cjs/normaliseUrlPathname.js +10 -0
  227. package/cjs/objectOmit.d.ts +2 -0
  228. package/cjs/objectOmit.js +14 -0
  229. package/cjs/objectPick.d.ts +2 -0
  230. package/cjs/objectPick.js +13 -0
  231. package/cjs/package.json +6 -0
  232. package/cjs/parseCookie.d.ts +3 -0
  233. package/cjs/parseCookie.js +38 -0
  234. package/cjs/parseURL.d.ts +11 -0
  235. package/cjs/parseURL.js +18 -0
  236. package/cjs/quaranteneProps.d.ts +7 -0
  237. package/cjs/quaranteneProps.js +20 -0
  238. package/cjs/randomInt.d.ts +2 -0
  239. package/cjs/randomInt.js +8 -0
  240. package/cjs/randomKey.d.ts +2 -0
  241. package/cjs/randomKey.js +9 -0
  242. package/cjs/readCookie.d.ts +3 -0
  243. package/cjs/readCookie.js +38 -0
  244. package/cjs/removeAccents.d.ts +3 -0
  245. package/cjs/removeAccents.js +16 -0
  246. package/cjs/removeCookie.d.ts +3 -0
  247. package/cjs/removeCookie.js +12 -0
  248. package/cjs/removeDuplicates.d.ts +0 -0
  249. package/cjs/removeDuplicates.js +1 -0
  250. package/cjs/removeDuplicatesByKey.d.ts +2 -0
  251. package/cjs/removeDuplicatesByKey.js +18 -0
  252. package/cjs/removeDuplicatesComparing.d.ts +2 -0
  253. package/cjs/removeDuplicatesComparing.js +11 -0
  254. package/cjs/removeIndexesFromArray.d.ts +2 -0
  255. package/cjs/removeIndexesFromArray.js +14 -0
  256. package/cjs/removeTrailingSlash.d.ts +2 -0
  257. package/cjs/removeTrailingSlash.js +9 -0
  258. package/cjs/removeUrlQueryParams.d.ts +2 -0
  259. package/cjs/removeUrlQueryParams.js +19 -0
  260. package/cjs/render.d.ts +13 -0
  261. package/cjs/render.js +123 -0
  262. package/cjs/roundTo.d.ts +2 -0
  263. package/cjs/roundTo.js +16 -0
  264. package/cjs/serializeCookie.d.ts +3 -0
  265. package/cjs/serializeCookie.js +74 -0
  266. package/cjs/setCookie.d.ts +3 -0
  267. package/cjs/setCookie.js +47 -0
  268. package/cjs/shuffle.d.ts +2 -0
  269. package/cjs/shuffle.js +22 -0
  270. package/cjs/slugify.d.ts +2 -0
  271. package/cjs/slugify.js +18 -0
  272. package/cjs/split.d.ts +3 -0
  273. package/cjs/split.js +8 -0
  274. package/cjs/swapMap.d.ts +2 -0
  275. package/cjs/swapMap.js +13 -0
  276. package/cjs/throttle.d.ts +2 -0
  277. package/cjs/throttle.js +24 -0
  278. package/cjs/titleCase.d.ts +2 -0
  279. package/cjs/titleCase.js +10 -0
  280. package/cjs/toNumber.d.ts +2 -0
  281. package/cjs/toNumber.js +9 -0
  282. package/cjs/toRgba.d.ts +2 -0
  283. package/cjs/toRgba.js +13 -0
  284. package/cjs/transformToUrlPathname.d.ts +2 -0
  285. package/cjs/transformToUrlPathname.js +11 -0
  286. package/cjs/truncate.d.ts +2 -0
  287. package/cjs/truncate.js +12 -0
  288. package/cjs/tryUntil.d.ts +2 -0
  289. package/cjs/tryUntil.js +19 -0
  290. package/cjs/types.d.ts +10 -0
  291. package/cjs/types.js +2 -0
  292. package/cjs/uid.d.ts +2 -0
  293. package/cjs/uid.js +11 -0
  294. package/cjs/updateLinkParams.d.ts +3 -0
  295. package/cjs/updateLinkParams.js +11 -0
  296. package/cjs/updateUrlQueryParams.d.ts +3 -0
  297. package/cjs/updateUrlQueryParams.js +16 -0
  298. package/cjs/uppercase.d.ts +2 -0
  299. package/cjs/uppercase.js +8 -0
  300. package/cjs/uuid.d.ts +2 -0
  301. package/cjs/uuid.js +11 -0
  302. package/cjs/uuidNumeric.d.ts +2 -0
  303. package/cjs/uuidNumeric.js +6 -0
  304. package/cjs/wait.d.ts +2 -0
  305. package/cjs/wait.js +8 -0
  306. package/cjs/without.d.ts +0 -0
  307. package/cjs/without.js +1 -0
  308. package/clamp.d.ts +0 -6
  309. package/clamp.js +4 -0
  310. package/clsx.d.ts +0 -7
  311. package/clsx.js +40 -0
  312. package/convertRange.d.ts +0 -14
  313. package/convertRange.js +4 -0
  314. package/cookie.d.ts +0 -48
  315. package/cookie.js +1 -0
  316. package/createPalette.d.ts +0 -12
  317. package/createPalette.js +12 -0
  318. package/debounce.d.ts +0 -6
  319. package/debounce.js +22 -0
  320. package/debouncePromise.d.ts +0 -18
  321. package/debouncePromise.js +65 -0
  322. package/debounceRaf.d.ts +0 -7
  323. package/debounceRaf.js +17 -0
  324. package/decode.d.ts +0 -4
  325. package/decode.js +6 -0
  326. package/encode.d.ts +0 -4
  327. package/encode.js +6 -0
  328. package/ensureInt.d.ts +0 -5
  329. package/ensureInt.js +4 -0
  330. package/env.js +1 -0
  331. package/errorToString.d.ts +0 -6
  332. package/errorToString.js +5 -0
  333. package/findDuplicatedIndexes.d.ts +0 -3
  334. package/findDuplicatedIndexes.js +11 -0
  335. package/forin.d.ts +0 -6
  336. package/forin.js +6 -0
  337. package/gbToBytes.d.ts +0 -5
  338. package/gbToBytes.js +2 -0
  339. package/getEmptyArray.d.ts +0 -6
  340. package/getEmptyArray.js +8 -0
  341. package/getKeys.d.ts +0 -8
  342. package/getKeys.js +2 -0
  343. package/getMediaQueryWidthResolvers.d.ts +0 -6
  344. package/getMediaQueryWidthResolvers.js +40 -0
  345. package/getMediaQueryWidthTailwindScreens.d.ts +1 -5
  346. package/getMediaQueryWidthTailwindScreens.js +27 -0
  347. package/getNonce.d.ts +0 -4
  348. package/getNonce.js +5 -0
  349. package/getParamAmong.d.ts +0 -11
  350. package/getParamAmong.js +7 -0
  351. package/getParamAsInt.d.ts +0 -10
  352. package/getParamAsInt.js +10 -0
  353. package/getParamAsString.d.ts +0 -9
  354. package/getParamAsString.js +5 -0
  355. package/getType.d.ts +0 -12
  356. package/getType.js +4 -0
  357. package/getUrlHashParams.d.ts +1 -7
  358. package/getUrlHashParams.js +10 -0
  359. package/getUrlHashPathname.d.ts +0 -7
  360. package/getUrlHashPathname.js +6 -0
  361. package/getUrlPathnameParts.d.ts +0 -10
  362. package/getUrlPathnameParts.js +10 -0
  363. package/getUrlQueryParams.d.ts +1 -11
  364. package/getUrlQueryParams.js +25 -0
  365. package/imgEmptyPixel.d.ts +0 -5
  366. package/imgEmptyPixel.js +2 -0
  367. package/index.d.ts +133 -136
  368. package/index.js +130 -0
  369. package/invariant.d.ts +0 -17
  370. package/invariant.js +17 -0
  371. package/isAnyObject.d.ts +1 -6
  372. package/isAnyObject.js +5 -0
  373. package/isArray.d.ts +0 -5
  374. package/isArray.js +5 -0
  375. package/isBlob.d.ts +0 -5
  376. package/isBlob.js +5 -0
  377. package/isBoolean.d.ts +0 -5
  378. package/isBoolean.js +5 -0
  379. package/isBrowser.d.ts +0 -4
  380. package/isBrowser.js +2 -0
  381. package/isBrowserNow.d.ts +0 -4
  382. package/isBrowserNow.js +3 -0
  383. package/isDate.d.ts +0 -5
  384. package/isDate.js +5 -0
  385. package/isEmptyArray.d.ts +0 -5
  386. package/isEmptyArray.js +5 -0
  387. package/isEmptyObject.d.ts +0 -5
  388. package/isEmptyObject.js +5 -0
  389. package/isEmptyString.d.ts +0 -5
  390. package/isEmptyString.js +4 -0
  391. package/isError.d.ts +0 -5
  392. package/isError.js +5 -0
  393. package/isExternalUrl.d.ts +0 -7
  394. package/isExternalUrl.js +12 -0
  395. package/isFile.d.ts +0 -5
  396. package/isFile.js +5 -0
  397. package/isFloat.d.ts +0 -5
  398. package/isFloat.js +5 -0
  399. package/isFormData.d.ts +0 -5
  400. package/isFormData.js +5 -0
  401. package/isFullArray.d.ts +0 -5
  402. package/isFullArray.js +5 -0
  403. package/isFullObject.d.ts +1 -6
  404. package/isFullObject.js +5 -0
  405. package/isFullString.d.ts +0 -5
  406. package/isFullString.js +5 -0
  407. package/isFunction.d.ts +1 -6
  408. package/isFunction.js +4 -0
  409. package/isInt.d.ts +0 -5
  410. package/isInt.js +5 -0
  411. package/isMap.d.ts +0 -5
  412. package/isMap.js +5 -0
  413. package/isNaNValue.d.ts +0 -5
  414. package/isNaNValue.js +5 -0
  415. package/isNegativeNumber.d.ts +0 -5
  416. package/isNegativeNumber.js +5 -0
  417. package/isNull.d.ts +0 -5
  418. package/isNull.js +5 -0
  419. package/isNullOrUndefined.d.ts +0 -5
  420. package/isNullOrUndefined.js +5 -0
  421. package/isNumber.d.ts +0 -7
  422. package/isNumber.js +5 -0
  423. package/isObject.d.ts +1 -6
  424. package/isObject.js +5 -0
  425. package/isObjectLike.d.ts +1 -8
  426. package/isObjectLike.js +5 -0
  427. package/isOneOf.d.ts +1 -4
  428. package/isOneOf.js +10 -0
  429. package/isPlainObject.d.ts +1 -6
  430. package/isPlainObject.js +8 -0
  431. package/isPositiveNumber.d.ts +0 -5
  432. package/isPositiveNumber.js +5 -0
  433. package/isPrimitive.d.ts +0 -5
  434. package/isPrimitive.js +15 -0
  435. package/isPromise.d.ts +0 -5
  436. package/isPromise.js +5 -0
  437. package/isRegExp.d.ts +0 -5
  438. package/isRegExp.js +5 -0
  439. package/isServer.d.ts +0 -4
  440. package/isServer.js +3 -0
  441. package/isServerNow.d.ts +0 -4
  442. package/isServerNow.js +3 -0
  443. package/isSet.d.ts +0 -5
  444. package/isSet.js +5 -0
  445. package/isString.d.ts +0 -5
  446. package/isString.js +5 -0
  447. package/isSymbol.d.ts +0 -5
  448. package/isSymbol.js +5 -0
  449. package/isType.d.ts +1 -9
  450. package/isType.js +13 -0
  451. package/isUndefined.d.ts +0 -5
  452. package/isUndefined.js +5 -0
  453. package/isWeakMap.d.ts +0 -5
  454. package/isWeakMap.js +5 -0
  455. package/isWeakSet.d.ts +0 -5
  456. package/isWeakSet.js +5 -0
  457. package/kbToBytes.d.ts +0 -5
  458. package/kbToBytes.js +2 -0
  459. package/location.d.ts +0 -3
  460. package/location.js +1 -0
  461. package/lowercase.d.ts +0 -5
  462. package/lowercase.js +4 -0
  463. package/mapListBy.d.ts +0 -5
  464. package/mapListBy.js +9 -0
  465. package/matchSorter.d.ts +0 -7
  466. package/matchSorter.js +255 -0
  467. package/mbToBytes.d.ts +0 -5
  468. package/mbToBytes.js +2 -0
  469. package/mergeObjects.d.ts +0 -6
  470. package/mergeObjects.js +33 -0
  471. package/mergeUrlQueryParams.d.ts +1 -6
  472. package/mergeUrlQueryParams.js +16 -0
  473. package/moveSortableArrayItemByKey.d.ts +0 -7
  474. package/moveSortableArrayItemByKey.js +10 -0
  475. package/noop.d.ts +0 -5
  476. package/noop.js +2 -0
  477. package/normaliseUrl.d.ts +0 -9
  478. package/normaliseUrl.js +6 -0
  479. package/normaliseUrlPathname.d.ts +0 -8
  480. package/normaliseUrlPathname.js +6 -0
  481. package/objectOmit.d.ts +0 -9
  482. package/objectOmit.js +10 -0
  483. package/objectPick.d.ts +0 -6
  484. package/objectPick.js +9 -0
  485. package/package.json +568 -6
  486. package/parseCookie.d.ts +1 -9
  487. package/parseCookie.js +34 -0
  488. package/parseURL.d.ts +0 -6
  489. package/parseURL.js +14 -0
  490. package/quaranteneProps.d.ts +0 -15
  491. package/quaranteneProps.js +16 -0
  492. package/randomInt.d.ts +0 -5
  493. package/randomInt.js +4 -0
  494. package/randomKey.d.ts +0 -6
  495. package/randomKey.js +5 -0
  496. package/readCookie.d.ts +0 -5
  497. package/{readCookie.mjs → readCookie.js} +8 -7
  498. package/removeAccents.d.ts +1 -4
  499. package/removeAccents.js +12 -0
  500. package/removeCookie.d.ts +1 -4
  501. package/removeCookie.js +8 -0
  502. package/removeDuplicates.js +1 -0
  503. package/removeDuplicatesByKey.d.ts +0 -6
  504. package/removeDuplicatesByKey.js +14 -0
  505. package/removeDuplicatesComparing.d.ts +0 -3
  506. package/removeDuplicatesComparing.js +7 -0
  507. package/removeIndexesFromArray.d.ts +0 -3
  508. package/removeIndexesFromArray.js +10 -0
  509. package/removeTrailingSlash.d.ts +0 -5
  510. package/removeTrailingSlash.js +5 -0
  511. package/removeUrlQueryParams.d.ts +0 -5
  512. package/removeUrlQueryParams.js +15 -0
  513. package/render.d.ts +0 -40
  514. package/render.js +119 -0
  515. package/roundTo.d.ts +0 -6
  516. package/roundTo.js +12 -0
  517. package/serializeCookie.d.ts +1 -21
  518. package/{serializeCookie.mjs → serializeCookie.js} +9 -33
  519. package/setCookie.d.ts +1 -4
  520. package/setCookie.js +43 -0
  521. package/shuffle.d.ts +0 -15
  522. package/shuffle.js +18 -0
  523. package/slugify.d.ts +0 -10
  524. package/slugify.js +14 -0
  525. package/split.d.ts +0 -4
  526. package/split.js +4 -0
  527. package/swapMap.d.ts +0 -5
  528. package/swapMap.js +9 -0
  529. package/throttle.d.ts +0 -7
  530. package/throttle.js +20 -0
  531. package/titleCase.d.ts +0 -6
  532. package/titleCase.js +6 -0
  533. package/toNumber.d.ts +0 -3
  534. package/toNumber.js +5 -0
  535. package/toRgba.d.ts +0 -3
  536. package/toRgba.js +9 -0
  537. package/transformToUrlPathname.d.ts +0 -9
  538. package/transformToUrlPathname.js +7 -0
  539. package/truncate.d.ts +0 -5
  540. package/truncate.js +8 -0
  541. package/tryUntil.d.ts +0 -9
  542. package/tryUntil.js +15 -0
  543. package/types.d.ts +0 -18
  544. package/types.js +1 -0
  545. package/uid.d.ts +0 -5
  546. package/uid.js +7 -0
  547. package/updateLinkParams.d.ts +1 -8
  548. package/updateLinkParams.js +7 -0
  549. package/updateUrlQueryParams.d.ts +1 -6
  550. package/updateUrlQueryParams.js +12 -0
  551. package/uppercase.d.ts +0 -6
  552. package/uppercase.js +4 -0
  553. package/uuid.d.ts +0 -6
  554. package/uuid.js +7 -0
  555. package/uuidNumeric.d.ts +0 -4
  556. package/uuidNumeric.js +2 -0
  557. package/wait.d.ts +0 -5
  558. package/wait.js +4 -0
  559. package/without.js +1 -0
  560. package/Defer.mjs +0 -27
  561. package/Emitter.mjs +0 -37
  562. package/README.md +0 -47
  563. package/accentSets.mjs +0 -123
  564. package/addOrReplaceAtIdx.mjs +0 -26
  565. package/areEqual.mjs +0 -71
  566. package/arrayOfAll.mjs +0 -26
  567. package/arraySum.mjs +0 -7
  568. package/arrayToLookup.mjs +0 -11
  569. package/buildUrlQueryString.mjs +0 -28
  570. package/capitalize.mjs +0 -11
  571. package/changeUrlPath.mjs +0 -17
  572. package/chunkByChunks.mjs +0 -34
  573. package/chunkBySize.mjs +0 -11
  574. package/clamp.mjs +0 -9
  575. package/clsx.mjs +0 -48
  576. package/convertRange.mjs +0 -17
  577. package/cookie.mjs +0 -15
  578. package/createPalette.mjs +0 -32
  579. package/debounce.mjs +0 -21
  580. package/debouncePromise.mjs +0 -79
  581. package/debounceRaf.mjs +0 -22
  582. package/decode.mjs +0 -9
  583. package/encode.mjs +0 -9
  584. package/ensureInt.mjs +0 -6
  585. package/env.mjs +0 -2
  586. package/errorToString.mjs +0 -8
  587. package/findDuplicatedIndexes.mjs +0 -13
  588. package/forin.mjs +0 -11
  589. package/gbToBytes.mjs +0 -6
  590. package/getEmptyArray.mjs +0 -15
  591. package/getKeys.mjs +0 -9
  592. package/getMediaQueryWidthResolvers.mjs +0 -67
  593. package/getMediaQueryWidthTailwindScreens.mjs +0 -36
  594. package/getNonce.mjs +0 -8
  595. package/getParamAmong.mjs +0 -16
  596. package/getParamAsInt.mjs +0 -18
  597. package/getParamAsString.mjs +0 -13
  598. package/getType.mjs +0 -14
  599. package/getUrlHashParams.mjs +0 -14
  600. package/getUrlHashPathname.mjs +0 -11
  601. package/getUrlPathnameParts.mjs +0 -15
  602. package/getUrlQueryParams.mjs +0 -26
  603. package/imgEmptyPixel.mjs +0 -6
  604. package/invariant.mjs +0 -32
  605. package/isAnyObject.mjs +0 -9
  606. package/isArray.mjs +0 -9
  607. package/isBlob.mjs +0 -9
  608. package/isBoolean.mjs +0 -9
  609. package/isBrowser.mjs +0 -5
  610. package/isBrowserNow.mjs +0 -6
  611. package/isDate.mjs +0 -9
  612. package/isEmptyArray.mjs +0 -9
  613. package/isEmptyObject.mjs +0 -9
  614. package/isEmptyString.mjs +0 -8
  615. package/isError.mjs +0 -9
  616. package/isExternalUrl.mjs +0 -19
  617. package/isFile.mjs +0 -9
  618. package/isFloat.mjs +0 -9
  619. package/isFormData.mjs +0 -9
  620. package/isFullArray.mjs +0 -9
  621. package/isFullObject.mjs +0 -9
  622. package/isFullString.mjs +0 -9
  623. package/isFunction.mjs +0 -8
  624. package/isInt.mjs +0 -9
  625. package/isMap.mjs +0 -9
  626. package/isNaNValue.mjs +0 -9
  627. package/isNegativeNumber.mjs +0 -9
  628. package/isNull.mjs +0 -9
  629. package/isNullOrUndefined.mjs +0 -9
  630. package/isNumber.mjs +0 -11
  631. package/isObject.mjs +0 -9
  632. package/isObjectLike.mjs +0 -11
  633. package/isOneOf.mjs +0 -4
  634. package/isPlainObject.mjs +0 -10
  635. package/isPositiveNumber.mjs +0 -9
  636. package/isPrimitive.mjs +0 -14
  637. package/isPromise.mjs +0 -9
  638. package/isRegExp.mjs +0 -9
  639. package/isServer.mjs +0 -7
  640. package/isServerNow.mjs +0 -6
  641. package/isSet.mjs +0 -9
  642. package/isString.mjs +0 -9
  643. package/isSymbol.mjs +0 -9
  644. package/isType.mjs +0 -20
  645. package/isUndefined.mjs +0 -9
  646. package/isWeakMap.mjs +0 -9
  647. package/isWeakSet.mjs +0 -9
  648. package/kbToBytes.mjs +0 -6
  649. package/location.mjs +0 -3
  650. package/lowercase.mjs +0 -6
  651. package/mapListBy.mjs +0 -11
  652. package/matchSorter.mjs +0 -352
  653. package/mbToBytes.mjs +0 -6
  654. package/mergeObjects.mjs +0 -34
  655. package/mergeUrlQueryParams.mjs +0 -17
  656. package/moveSortableArrayItemByKey.mjs +0 -17
  657. package/noop.mjs +0 -6
  658. package/normaliseUrl.mjs +0 -13
  659. package/normaliseUrlPathname.mjs +0 -12
  660. package/objectOmit.mjs +0 -17
  661. package/objectPick.mjs +0 -14
  662. package/parseCookie.mjs +0 -44
  663. package/parseURL.mjs +0 -19
  664. package/quaranteneProps.mjs +0 -31
  665. package/randomInt.mjs +0 -8
  666. package/randomKey.mjs +0 -10
  667. package/removeAccents.mjs +0 -12
  668. package/removeCookie.mjs +0 -12
  669. package/removeDuplicates.mjs +0 -12
  670. package/removeDuplicatesByKey.mjs +0 -18
  671. package/removeDuplicatesComparing.mjs +0 -9
  672. package/removeIndexesFromArray.mjs +0 -13
  673. package/removeTrailingSlash.mjs +0 -8
  674. package/removeUrlQueryParams.mjs +0 -18
  675. package/render.mjs +0 -111
  676. package/roundTo.mjs +0 -32
  677. package/setCookie.mjs +0 -51
  678. package/shuffle.mjs +0 -33
  679. package/slugify.mjs +0 -26
  680. package/split.mjs +0 -7
  681. package/swapMap.mjs +0 -12
  682. package/throttle.mjs +0 -20
  683. package/titleCase.mjs +0 -7
  684. package/toNumber.mjs +0 -7
  685. package/toRgba.mjs +0 -14
  686. package/transformToUrlPathname.mjs +0 -13
  687. package/truncate.mjs +0 -6
  688. package/tryUntil.mjs +0 -27
  689. package/types.mjs +0 -2
  690. package/uid.mjs +0 -10
  691. package/updateLinkParams.mjs +0 -13
  692. package/updateUrlQueryParams.mjs +0 -13
  693. package/uppercase.mjs +0 -7
  694. package/uuid.mjs +0 -10
  695. package/uuidNumeric.mjs +0 -5
  696. package/wait.mjs +0 -6
  697. package/without.mjs +0 -54
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isWeakMap = void 0;
4
+ var getType_1 = require("./getType");
5
+ function isWeakMap(payload) {
6
+ return (0, getType_1.default)(payload) === "WeakMap";
7
+ }
8
+ exports.isWeakMap = isWeakMap;
9
+ exports.default = isWeakMap;
@@ -0,0 +1,2 @@
1
+ export declare function isWeakSet(payload: any): payload is WeakSet<any>;
2
+ export default isWeakSet;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isWeakSet = void 0;
4
+ var getType_1 = require("./getType");
5
+ function isWeakSet(payload) {
6
+ return (0, getType_1.default)(payload) === "WeakSet";
7
+ }
8
+ exports.isWeakSet = isWeakSet;
9
+ exports.default = isWeakSet;
@@ -0,0 +1,2 @@
1
+ export declare const kbToBytes: (bytes: number) => number;
2
+ export default kbToBytes;
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.kbToBytes = void 0;
4
+ var kbToBytes = function (bytes) { return bytes * 1000; };
5
+ exports.kbToBytes = kbToBytes;
6
+ exports.default = exports.kbToBytes;
@@ -0,0 +1 @@
1
+ export type AnyQueryParams = undefined | null | Record<string | number, unknown>;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ export declare const lowercase: <T extends string>(str?: T | null | undefined) => Lowercase<T>;
2
+ export default lowercase;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.lowercase = void 0;
4
+ var lowercase = function (str) {
5
+ return (str || "").toLowerCase();
6
+ };
7
+ exports.lowercase = lowercase;
8
+ exports.default = exports.lowercase;
@@ -0,0 +1,2 @@
1
+ export declare function mapListBy<T extends Record<string | number | symbol, any>>(array?: T[], key?: keyof T): Record<T[keyof T], T>;
2
+ export default mapListBy;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.mapListBy = void 0;
4
+ function mapListBy(array, key) {
5
+ if (array === void 0) { array = []; }
6
+ if (key === void 0) { key = ""; }
7
+ return array.reduce(function (obj, item) {
8
+ obj[item[key]] = item;
9
+ return obj;
10
+ }, {});
11
+ }
12
+ exports.mapListBy = mapListBy;
13
+ exports.default = mapListBy;
@@ -0,0 +1,54 @@
1
+ type KeyAttributes = {
2
+ threshold?: Ranking;
3
+ maxRanking: Ranking;
4
+ minRanking: Ranking;
5
+ };
6
+ interface RankingInfo {
7
+ rankedValue: string;
8
+ rank: Ranking;
9
+ keyIndex: number;
10
+ keyThreshold: Ranking | undefined;
11
+ }
12
+ interface ValueGetterKey<ItemType> {
13
+ (item: ItemType): string | Array<string>;
14
+ }
15
+ interface IndexedItem<ItemType> {
16
+ item: ItemType;
17
+ index: number;
18
+ }
19
+ interface RankedItem<ItemType> extends RankingInfo, IndexedItem<ItemType> {
20
+ }
21
+ interface BaseSorter<ItemType> {
22
+ (a: RankedItem<ItemType>, b: RankedItem<ItemType>): number;
23
+ }
24
+ interface Sorter<ItemType> {
25
+ (matchItems: Array<RankedItem<ItemType>>): Array<RankedItem<ItemType>>;
26
+ }
27
+ interface KeyAttributesOptions<ItemType> {
28
+ key?: string | ValueGetterKey<ItemType>;
29
+ threshold?: Ranking;
30
+ maxRanking?: Ranking;
31
+ minRanking?: Ranking;
32
+ }
33
+ type KeyOption<ItemType> = KeyAttributesOptions<ItemType> | ValueGetterKey<ItemType> | string;
34
+ interface MatchSorterOptions<ItemType = unknown> {
35
+ keys?: ReadonlyArray<KeyOption<ItemType>>;
36
+ threshold?: Ranking;
37
+ baseSort?: BaseSorter<ItemType>;
38
+ keepDiacritics?: boolean;
39
+ sorter?: Sorter<ItemType>;
40
+ }
41
+ declare const RANKING_CASE_SENSITIVE_EQUAL = 7;
42
+ declare const RANKING_EQUAL = 6;
43
+ declare const RANKING_STARTS_WITH = 5;
44
+ declare const RANKING_WORD_STARTS_WITH = 4;
45
+ declare const RANKING_CONTAINS = 3;
46
+ declare const RANKING_ACRONYM = 2;
47
+ declare const RANKING_MATCHES = 1;
48
+ declare const RANKING_NO_MATCH = 0;
49
+ type Ranking = typeof RANKING_CASE_SENSITIVE_EQUAL | typeof RANKING_EQUAL | typeof RANKING_STARTS_WITH | typeof RANKING_WORD_STARTS_WITH | typeof RANKING_CONTAINS | typeof RANKING_ACRONYM | typeof RANKING_MATCHES | typeof RANKING_NO_MATCH;
50
+ declare const defaultBaseSortFn: BaseSorter<unknown>;
51
+ declare function matchSorter<ItemType = string>(items: ReadonlyArray<ItemType>, value: string, options?: MatchSorterOptions<ItemType>): Array<ItemType>;
52
+ export { matchSorter, defaultBaseSortFn };
53
+ export type { MatchSorterOptions, KeyAttributesOptions, KeyOption, KeyAttributes, RankingInfo, ValueGetterKey, };
54
+ export default matchSorter;
@@ -0,0 +1,259 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.defaultBaseSortFn = exports.matchSorter = void 0;
4
+ var tslib_1 = require("tslib");
5
+ var removeAccents_1 = require("./removeAccents");
6
+ var RANKING_CASE_SENSITIVE_EQUAL = 7;
7
+ var RANKING_EQUAL = 6;
8
+ var RANKING_STARTS_WITH = 5;
9
+ var RANKING_WORD_STARTS_WITH = 4;
10
+ var RANKING_CONTAINS = 3;
11
+ var RANKING_ACRONYM = 2;
12
+ var RANKING_MATCHES = 1;
13
+ var RANKING_NO_MATCH = 0;
14
+ var defaultBaseSortFn = function (a, b) {
15
+ return String(a.rankedValue).localeCompare(String(b.rankedValue));
16
+ };
17
+ exports.defaultBaseSortFn = defaultBaseSortFn;
18
+ function matchSorter(items, value, options) {
19
+ if (options === void 0) { options = {}; }
20
+ var keys = options.keys, _a = options.threshold, threshold = _a === void 0 ? RANKING_MATCHES : _a, _b = options.baseSort, baseSort = _b === void 0 ? defaultBaseSortFn : _b, _c = options.sorter, sorter = _c === void 0 ? function (matchedItems) {
21
+ return matchedItems.sort(function (a, b) { return sortRankedValues(a, b, baseSort); });
22
+ } : _c;
23
+ var matchedItems = items.reduce(reduceItemsToRanked, []);
24
+ return sorter(matchedItems).map(function (_a) {
25
+ var item = _a.item;
26
+ return item;
27
+ });
28
+ function reduceItemsToRanked(matches, item, index) {
29
+ var rankingInfo = getHighestRanking(item, keys, value, options);
30
+ var rank = rankingInfo.rank, _a = rankingInfo.keyThreshold, keyThreshold = _a === void 0 ? threshold : _a;
31
+ if (rank >= keyThreshold) {
32
+ matches.push(tslib_1.__assign(tslib_1.__assign({}, rankingInfo), { item: item, index: index }));
33
+ }
34
+ return matches;
35
+ }
36
+ }
37
+ exports.matchSorter = matchSorter;
38
+ function getHighestRanking(item, keys, value, options) {
39
+ if (!keys) {
40
+ var stringItem = item;
41
+ return {
42
+ rankedValue: stringItem,
43
+ rank: getMatchRanking(stringItem, value, options),
44
+ keyIndex: -1,
45
+ keyThreshold: options.threshold,
46
+ };
47
+ }
48
+ var valuesToRank = getAllValuesToRank(item, keys);
49
+ return valuesToRank.reduce(function (_a, _b, i) {
50
+ var rank = _a.rank, rankedValue = _a.rankedValue, keyIndex = _a.keyIndex, keyThreshold = _a.keyThreshold;
51
+ var itemValue = _b.itemValue, attributes = _b.attributes;
52
+ var newRank = getMatchRanking(itemValue, value, options);
53
+ var newRankedValue = rankedValue;
54
+ var minRanking = attributes.minRanking, maxRanking = attributes.maxRanking, threshold = attributes.threshold;
55
+ if (newRank < minRanking && newRank >= RANKING_MATCHES) {
56
+ newRank = minRanking;
57
+ }
58
+ else if (newRank > maxRanking) {
59
+ newRank = maxRanking;
60
+ }
61
+ if (newRank > rank) {
62
+ rank = newRank;
63
+ keyIndex = i;
64
+ keyThreshold = threshold;
65
+ newRankedValue = itemValue;
66
+ }
67
+ return { rankedValue: newRankedValue, rank: rank, keyIndex: keyIndex, keyThreshold: keyThreshold };
68
+ }, {
69
+ rankedValue: item,
70
+ rank: RANKING_NO_MATCH,
71
+ keyIndex: -1,
72
+ keyThreshold: options.threshold,
73
+ });
74
+ }
75
+ function getMatchRanking(testString, stringToRank, options) {
76
+ testString = prepareValueForComparison(testString, options);
77
+ stringToRank = prepareValueForComparison(stringToRank, options);
78
+ if (stringToRank.length > testString.length) {
79
+ return RANKING_NO_MATCH;
80
+ }
81
+ if (testString === stringToRank) {
82
+ return RANKING_CASE_SENSITIVE_EQUAL;
83
+ }
84
+ testString = testString.toLowerCase();
85
+ stringToRank = stringToRank.toLowerCase();
86
+ if (testString === stringToRank) {
87
+ return RANKING_EQUAL;
88
+ }
89
+ if (testString.startsWith(stringToRank)) {
90
+ return RANKING_STARTS_WITH;
91
+ }
92
+ if (testString.includes(" ".concat(stringToRank))) {
93
+ return RANKING_WORD_STARTS_WITH;
94
+ }
95
+ if (testString.includes(stringToRank)) {
96
+ return RANKING_CONTAINS;
97
+ }
98
+ else if (stringToRank.length === 1) {
99
+ return RANKING_NO_MATCH;
100
+ }
101
+ if (getAcronym(testString).includes(stringToRank)) {
102
+ return RANKING_ACRONYM;
103
+ }
104
+ return getClosenessRanking(testString, stringToRank);
105
+ }
106
+ function getAcronym(string) {
107
+ var acronym = "";
108
+ var wordsInString = string.split(" ");
109
+ wordsInString.forEach(function (wordInString) {
110
+ var splitByHyphenWords = wordInString.split("-");
111
+ splitByHyphenWords.forEach(function (splitByHyphenWord) {
112
+ acronym += splitByHyphenWord.substring(0, 1);
113
+ });
114
+ });
115
+ return acronym;
116
+ }
117
+ function getClosenessRanking(testString, stringToRank) {
118
+ var matchingInOrderCharCount = 0;
119
+ var charNumber = 0;
120
+ function findMatchingCharacter(matchChar, string, index) {
121
+ for (var j = index, J = string.length; j < J; j++) {
122
+ var stringChar = string[j];
123
+ if (stringChar === matchChar) {
124
+ matchingInOrderCharCount += 1;
125
+ return j + 1;
126
+ }
127
+ }
128
+ return -1;
129
+ }
130
+ function getRanking(spread) {
131
+ var spreadPercentage = 1 / spread;
132
+ var inOrderPercentage = matchingInOrderCharCount / stringToRank.length;
133
+ var ranking = RANKING_MATCHES + inOrderPercentage * spreadPercentage;
134
+ return ranking;
135
+ }
136
+ var firstIndex = findMatchingCharacter(stringToRank[0], testString, 0);
137
+ if (firstIndex < 0) {
138
+ return RANKING_NO_MATCH;
139
+ }
140
+ charNumber = firstIndex;
141
+ for (var i = 1, I = stringToRank.length; i < I; i++) {
142
+ var matchChar = stringToRank[i];
143
+ charNumber = findMatchingCharacter(matchChar, testString, charNumber);
144
+ var found = charNumber > -1;
145
+ if (!found) {
146
+ return RANKING_NO_MATCH;
147
+ }
148
+ }
149
+ var spread = charNumber - firstIndex;
150
+ return getRanking(spread);
151
+ }
152
+ function sortRankedValues(a, b, baseSort) {
153
+ var aFirst = -1;
154
+ var bFirst = 1;
155
+ var aRank = a.rank, aKeyIndex = a.keyIndex;
156
+ var bRank = b.rank, bKeyIndex = b.keyIndex;
157
+ var same = aRank === bRank;
158
+ if (same) {
159
+ if (aKeyIndex === bKeyIndex) {
160
+ return baseSort(a, b);
161
+ }
162
+ else {
163
+ return aKeyIndex < bKeyIndex ? aFirst : bFirst;
164
+ }
165
+ }
166
+ else {
167
+ return aRank > bRank ? aFirst : bFirst;
168
+ }
169
+ }
170
+ function prepareValueForComparison(value, _a) {
171
+ var keepDiacritics = _a.keepDiacritics;
172
+ value = "".concat(value);
173
+ if (!keepDiacritics) {
174
+ value = (0, removeAccents_1.default)(value);
175
+ }
176
+ return value;
177
+ }
178
+ function getItemValues(item, key) {
179
+ if (typeof key === "object") {
180
+ key = key.key;
181
+ }
182
+ var value;
183
+ if (typeof key === "function") {
184
+ value = key(item);
185
+ }
186
+ else if (item == null) {
187
+ value = null;
188
+ }
189
+ else if (Object.hasOwnProperty.call(item, key)) {
190
+ value = item[key];
191
+ }
192
+ else if (key.includes(".")) {
193
+ return getNestedValues(key, item);
194
+ }
195
+ else {
196
+ value = null;
197
+ }
198
+ if (value == null) {
199
+ return [];
200
+ }
201
+ if (Array.isArray(value)) {
202
+ return value;
203
+ }
204
+ return [String(value)];
205
+ }
206
+ function getNestedValues(path, item) {
207
+ var keys = path.split(".");
208
+ var values = [item];
209
+ for (var i = 0, I = keys.length; i < I; i++) {
210
+ var nestedKey = keys[i];
211
+ var nestedValues = [];
212
+ for (var j = 0, J = values.length; j < J; j++) {
213
+ var nestedItem = values[j];
214
+ if (nestedItem == null)
215
+ continue;
216
+ if (Object.hasOwnProperty.call(nestedItem, nestedKey)) {
217
+ var nestedValue = nestedItem[nestedKey];
218
+ if (nestedValue != null) {
219
+ nestedValues.push(nestedValue);
220
+ }
221
+ }
222
+ else if (nestedKey === "*") {
223
+ nestedValues = nestedValues.concat(nestedItem);
224
+ }
225
+ }
226
+ values = nestedValues;
227
+ }
228
+ if (Array.isArray(values[0])) {
229
+ var result = [];
230
+ return result.concat.apply(result, values);
231
+ }
232
+ return values;
233
+ }
234
+ function getAllValuesToRank(item, keys) {
235
+ var allValues = [];
236
+ for (var j = 0, J = keys.length; j < J; j++) {
237
+ var key = keys[j];
238
+ var attributes = getKeyAttributes(key);
239
+ var itemValues = getItemValues(item, key);
240
+ for (var i = 0, I = itemValues.length; i < I; i++) {
241
+ allValues.push({
242
+ itemValue: itemValues[i],
243
+ attributes: attributes,
244
+ });
245
+ }
246
+ }
247
+ return allValues;
248
+ }
249
+ var defaultKeyAttributes = {
250
+ maxRanking: Infinity,
251
+ minRanking: -Infinity,
252
+ };
253
+ function getKeyAttributes(key) {
254
+ if (typeof key === "string") {
255
+ return defaultKeyAttributes;
256
+ }
257
+ return tslib_1.__assign(tslib_1.__assign({}, defaultKeyAttributes), key);
258
+ }
259
+ exports.default = matchSorter;
@@ -0,0 +1,2 @@
1
+ export declare const mbToBytes: (bytes: number) => number;
2
+ export default mbToBytes;
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.mbToBytes = void 0;
4
+ var mbToBytes = function (bytes) { return bytes * 1000 * 1000; };
5
+ exports.mbToBytes = mbToBytes;
6
+ exports.default = exports.mbToBytes;
@@ -0,0 +1 @@
1
+ export declare const mergeObjects: <T extends object = object>(target: T, ...sources: Partial<T>[]) => T;
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.mergeObjects = void 0;
4
+ var tslib_1 = require("tslib");
5
+ var isObject_1 = require("./isObject");
6
+ var isUndefined_1 = require("./isUndefined");
7
+ var mergeObjects = function (target) {
8
+ var sources = [];
9
+ for (var _i = 1; _i < arguments.length; _i++) {
10
+ sources[_i - 1] = arguments[_i];
11
+ }
12
+ if (!sources.length) {
13
+ return target;
14
+ }
15
+ var source = sources.shift();
16
+ if (source === undefined) {
17
+ return target;
18
+ }
19
+ if ((0, isObject_1.isObject)(target) && (0, isObject_1.isObject)(source)) {
20
+ Object.keys(source).forEach(function (_key) {
21
+ var key = _key;
22
+ if ((0, isObject_1.isObject)(source[key])) {
23
+ if (!target[key]) {
24
+ target[key] = {};
25
+ }
26
+ (0, exports.mergeObjects)(target[key], source[key]);
27
+ }
28
+ else {
29
+ if (!(0, isUndefined_1.isUndefined)(source[key])) {
30
+ target[key] = source[key];
31
+ }
32
+ }
33
+ });
34
+ }
35
+ return exports.mergeObjects.apply(void 0, tslib_1.__spreadArray([target], sources, false));
36
+ };
37
+ exports.mergeObjects = mergeObjects;
@@ -0,0 +1,3 @@
1
+ import { type AnyQueryParams } from "./location";
2
+ export declare function mergeUrlQueryParams<T extends AnyQueryParams>(oldParams?: NonNullable<AnyQueryParams>, newParams?: NonNullable<AnyQueryParams>): T;
3
+ export default mergeUrlQueryParams;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.mergeUrlQueryParams = void 0;
4
+ var isNull_1 = require("./isNull");
5
+ function mergeUrlQueryParams(oldParams, newParams) {
6
+ if (oldParams === void 0) { oldParams = {}; }
7
+ if (newParams === void 0) { newParams = {}; }
8
+ for (var key in newParams) {
9
+ var value = newParams[key];
10
+ if (oldParams[key] && (0, isNull_1.default)(value)) {
11
+ delete oldParams[key];
12
+ }
13
+ else {
14
+ oldParams[key] = value;
15
+ }
16
+ }
17
+ return oldParams;
18
+ }
19
+ exports.mergeUrlQueryParams = mergeUrlQueryParams;
20
+ exports.default = mergeUrlQueryParams;
@@ -0,0 +1,2 @@
1
+ export declare function moveSortableArrayItemByKey<T, K extends keyof T>(items: T[], key: K, fromItem: Pick<T, K>, toItem: Pick<T, K>): T[];
2
+ export default moveSortableArrayItemByKey;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.moveSortableArrayItemByKey = void 0;
4
+ var tslib_1 = require("tslib");
5
+ function moveSortableArrayItemByKey(items, key, fromItem, toItem) {
6
+ var itemsKeys = items.map(function (item) { return item[key]; });
7
+ var idxFrom = itemsKeys.indexOf(fromItem[key]);
8
+ var idxTo = itemsKeys.indexOf(toItem[key]);
9
+ var item = items.splice(idxFrom, 1)[0];
10
+ items.splice(idxTo, 0, item);
11
+ return tslib_1.__spreadArray([], items, true);
12
+ }
13
+ exports.moveSortableArrayItemByKey = moveSortableArrayItemByKey;
14
+ exports.default = moveSortableArrayItemByKey;
package/cjs/noop.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export declare const noop: () => void | undefined;
2
+ export default noop;
package/cjs/noop.js ADDED
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.noop = void 0;
4
+ var noop = function () { return void 0; };
5
+ exports.noop = noop;
6
+ exports.default = exports.noop;
@@ -0,0 +1,2 @@
1
+ export declare function normaliseUrl(absoluteUrl?: string): string;
2
+ export default normaliseUrl;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.normaliseUrl = void 0;
4
+ var removeTrailingSlash_1 = require("./removeTrailingSlash");
5
+ function normaliseUrl(absoluteUrl) {
6
+ if (absoluteUrl === void 0) { absoluteUrl = ""; }
7
+ return (0, removeTrailingSlash_1.default)(absoluteUrl.replace(/(:\/\/)|(\/)+/g, "$1$2"));
8
+ }
9
+ exports.normaliseUrl = normaliseUrl;
10
+ exports.default = normaliseUrl;
@@ -0,0 +1,2 @@
1
+ export declare function normaliseUrlPathname(pathname?: string): string;
2
+ export default normaliseUrlPathname;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.normaliseUrlPathname = void 0;
4
+ var removeTrailingSlash_1 = require("./removeTrailingSlash");
5
+ function normaliseUrlPathname(pathname) {
6
+ if (pathname === void 0) { pathname = ""; }
7
+ return (0, removeTrailingSlash_1.default)(pathname.replace(/\/+/g, "/"));
8
+ }
9
+ exports.normaliseUrlPathname = normaliseUrlPathname;
10
+ exports.default = normaliseUrlPathname;
@@ -0,0 +1,2 @@
1
+ export declare function objectOmit<T extends object, Keys extends (keyof T)[]>(object: T, keys: Keys): Omit<T, Keys[number]>;
2
+ export default objectOmit;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.objectOmit = void 0;
4
+ function objectOmit(object, keys) {
5
+ return Object.keys(object).reduce(function (output, key) {
6
+ if (!keys.includes(key)) {
7
+ output[key] =
8
+ object[key];
9
+ }
10
+ return output;
11
+ }, {});
12
+ }
13
+ exports.objectOmit = objectOmit;
14
+ exports.default = objectOmit;
@@ -0,0 +1,2 @@
1
+ export declare function objectPick<T extends object, Keys extends (keyof T)[]>(object: T, keys: Keys): Pick<T, Keys[number]>;
2
+ export default objectPick;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.objectPick = void 0;
4
+ function objectPick(object, keys) {
5
+ var output = {};
6
+ var len = keys.length;
7
+ while (len--) {
8
+ output[keys[len]] = object[keys[len]];
9
+ }
10
+ return output;
11
+ }
12
+ exports.objectPick = objectPick;
13
+ exports.default = objectPick;
@@ -0,0 +1,6 @@
1
+ {
2
+ "name": "@koine/utils",
3
+ "sideEffects": false,
4
+ "main": "./index.js",
5
+ "types": "./index.d.ts"
6
+ }
@@ -0,0 +1,3 @@
1
+ import { type CookieAttributesServer } from "./cookie";
2
+ export declare function parseCookie<T extends Record<string, unknown> = Record<string, string>>(str: string, attributes?: CookieAttributesServer): T;
3
+ export default parseCookie;
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseCookie = void 0;
4
+ function tryDecode(str, decode) {
5
+ try {
6
+ return decode(str);
7
+ }
8
+ catch (e) {
9
+ return str;
10
+ }
11
+ }
12
+ function parseCookie(str, attributes) {
13
+ if (attributes === void 0) { attributes = {}; }
14
+ if (typeof str !== "string") {
15
+ throw new TypeError("argument str must be a string");
16
+ }
17
+ var obj = {};
18
+ var pairs = str.split(";");
19
+ var _a = attributes.decode, decode = _a === void 0 ? decodeURIComponent : _a;
20
+ for (var i = 0; i < pairs.length; i++) {
21
+ var pair = pairs[i];
22
+ var index = pair.indexOf("=");
23
+ if (index < 0) {
24
+ continue;
25
+ }
26
+ var key = pair.substring(0, index).trim();
27
+ if (undefined == obj[key]) {
28
+ var val = pair.substring(index + 1, pair.length).trim();
29
+ if (val[0] === '"') {
30
+ val = val.slice(1, -1);
31
+ }
32
+ obj[key] = tryDecode(val, decode);
33
+ }
34
+ }
35
+ return obj;
36
+ }
37
+ exports.parseCookie = parseCookie;
38
+ exports.default = parseCookie;
@@ -0,0 +1,11 @@
1
+ export declare function parseURL(url: string): {
2
+ href: string;
3
+ protocol: string;
4
+ host: string;
5
+ hostname: string;
6
+ port: string;
7
+ pathname: string;
8
+ search: string;
9
+ hash: string;
10
+ } | null;
11
+ export default parseURL;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseURL = void 0;
4
+ function parseURL(url) {
5
+ var match = url.match(/^(https?:)\/\/(([^:/?#]*)(?::([0-9]+))?)([/]{0,1}[^?#]*)(\?[^#]*|)(#.*|)$/);
6
+ return (match && {
7
+ href: url,
8
+ protocol: match[1],
9
+ host: match[2],
10
+ hostname: match[3],
11
+ port: match[4],
12
+ pathname: match[5],
13
+ search: match[6],
14
+ hash: match[7],
15
+ });
16
+ }
17
+ exports.parseURL = parseURL;
18
+ exports.default = parseURL;
@@ -0,0 +1,7 @@
1
+ export declare function quaranteneProps<TProps extends Record<never, never>, TSupectPropsKeys extends QuaranteneProps<TProps>>(props: TProps, propsKeysToQuarantene: TSupectPropsKeys): Omit<TProps, TSupectPropsKeys[number]> & {
2
+ _: Pick<TProps, TSupectPropsKeys[number]>;
3
+ };
4
+ export default quaranteneProps;
5
+ type QuaranteneProps<TProps extends Record<never, never>> = readonly (keyof {
6
+ [K in keyof TProps]?: TProps[K];
7
+ })[];