@koine/utils 2.0.0-beta.82 → 2.0.0-beta.83

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 (325) hide show
  1. package/Defer.cjs.js +20 -1
  2. package/Defer.esm.js +20 -1
  3. package/Emitter.cjs.js +18 -1
  4. package/Emitter.esm.js +18 -1
  5. package/accentsSets.cjs.js +13 -1
  6. package/accentsSets.esm.js +13 -1
  7. package/addOrReplaceAtIdx.cjs.js +7 -1
  8. package/addOrReplaceAtIdx.esm.js +7 -1
  9. package/areEqual.cjs.js +28 -1
  10. package/areEqual.esm.js +28 -1
  11. package/arrayFilterFalsy.cjs.js +6 -1
  12. package/arrayFilterFalsy.esm.js +6 -1
  13. package/arrayFindLastIndex.cjs.js +13 -1
  14. package/arrayFindLastIndex.esm.js +13 -1
  15. package/arrayOfAll.cjs.js +16 -1
  16. package/arrayOfAll.esm.js +16 -1
  17. package/arraySum.cjs.js +6 -1
  18. package/arraySum.esm.js +6 -1
  19. package/arrayToLookup.cjs.js +5 -1
  20. package/arrayToLookup.esm.js +5 -1
  21. package/arrayUniqueByProperties.cjs.js +8 -1
  22. package/arrayUniqueByProperties.esm.js +8 -1
  23. package/buildUrlQueryString.cjs.js +10 -1
  24. package/buildUrlQueryString.esm.js +10 -1
  25. package/capitalize.cjs.js +7 -1
  26. package/capitalize.esm.js +7 -1
  27. package/changeCaseCamel.cjs.js +7 -1
  28. package/changeCaseCamel.esm.js +7 -1
  29. package/changeCaseCapital.cjs.js +7 -1
  30. package/changeCaseCapital.esm.js +7 -1
  31. package/changeCaseConstant.cjs.js +7 -1
  32. package/changeCaseConstant.esm.js +7 -1
  33. package/changeCaseDot.cjs.js +7 -1
  34. package/changeCaseDot.esm.js +7 -1
  35. package/changeCaseHelpers.cjs.js +32 -1
  36. package/changeCaseHelpers.esm.js +32 -1
  37. package/changeCaseKebab.cjs.js +7 -1
  38. package/changeCaseKebab.esm.js +7 -1
  39. package/changeCaseNone.cjs.js +7 -1
  40. package/changeCaseNone.esm.js +7 -1
  41. package/changeCasePascal.cjs.js +7 -1
  42. package/changeCasePascal.esm.js +7 -1
  43. package/changeCasePascalSnake.cjs.js +7 -1
  44. package/changeCasePascalSnake.esm.js +7 -1
  45. package/changeCasePath.cjs.js +7 -1
  46. package/changeCasePath.esm.js +7 -1
  47. package/changeCaseSentence.cjs.js +7 -1
  48. package/changeCaseSentence.esm.js +7 -1
  49. package/changeCaseSnake.cjs.js +7 -1
  50. package/changeCaseSnake.esm.js +7 -1
  51. package/changeCaseTrain.cjs.js +7 -1
  52. package/changeCaseTrain.esm.js +7 -1
  53. package/chunkByChunks.cjs.js +5 -1
  54. package/chunkByChunks.esm.js +5 -1
  55. package/chunkBySize.cjs.js +4 -1
  56. package/chunkBySize.esm.js +4 -1
  57. package/clamp.cjs.js +6 -1
  58. package/clamp.esm.js +6 -1
  59. package/clsx.cjs.js +2 -1
  60. package/clsx.esm.js +2 -1
  61. package/convertRange.cjs.js +14 -1
  62. package/convertRange.esm.js +14 -1
  63. package/cookie.cjs.js +44 -1
  64. package/cookie.esm.js +44 -1
  65. package/createPalette.cjs.js +17 -1
  66. package/createPalette.esm.js +17 -1
  67. package/debounce.cjs.js +7 -1
  68. package/debounce.esm.js +7 -1
  69. package/debouncePromise.cjs.js +10 -1
  70. package/debouncePromise.esm.js +10 -1
  71. package/debounceRaf.cjs.js +4 -1
  72. package/debounceRaf.esm.js +4 -1
  73. package/decode.cjs.js +4 -1
  74. package/decode.esm.js +4 -1
  75. package/encode.cjs.js +4 -1
  76. package/encode.esm.js +4 -1
  77. package/ensureInt.cjs.js +5 -1
  78. package/ensureInt.esm.js +5 -1
  79. package/errorToString.cjs.js +6 -1
  80. package/errorToString.esm.js +6 -1
  81. package/escapeRegExp.cjs.js +7 -1
  82. package/escapeRegExp.esm.js +7 -1
  83. package/findDuplicatedIndexes.cjs.js +3 -1
  84. package/findDuplicatedIndexes.esm.js +3 -1
  85. package/forin.cjs.js +6 -1
  86. package/forin.esm.js +6 -1
  87. package/gbToBytes.cjs.js +5 -1
  88. package/gbToBytes.esm.js +5 -1
  89. package/getEmptyArray.cjs.js +6 -1
  90. package/getEmptyArray.esm.js +6 -1
  91. package/getKeys.cjs.js +8 -1
  92. package/getKeys.esm.js +8 -1
  93. package/getMediaQueryWidthResolvers.cjs.js +27 -1
  94. package/getMediaQueryWidthResolvers.esm.js +27 -1
  95. package/getMediaQueryWidthTailwindScreens.cjs.js +6 -1
  96. package/getMediaQueryWidthTailwindScreens.esm.js +6 -1
  97. package/getNonce.cjs.js +4 -1
  98. package/getNonce.esm.js +4 -1
  99. package/getParamAmong.cjs.js +11 -1
  100. package/getParamAmong.esm.js +11 -1
  101. package/getParamAsInt.cjs.js +10 -1
  102. package/getParamAsInt.esm.js +10 -1
  103. package/getParamAsString.cjs.js +9 -1
  104. package/getParamAsString.esm.js +9 -1
  105. package/getType.cjs.js +13 -1
  106. package/getType.esm.js +13 -1
  107. package/getUrlHashParams.cjs.js +6 -1
  108. package/getUrlHashParams.esm.js +6 -1
  109. package/getUrlHashPathname.cjs.js +7 -1
  110. package/getUrlHashPathname.esm.js +7 -1
  111. package/getUrlPathnameParts.cjs.js +10 -1
  112. package/getUrlPathnameParts.esm.js +10 -1
  113. package/getUrlQueryParams.cjs.js +12 -1
  114. package/getUrlQueryParams.esm.js +12 -1
  115. package/hashAny.cjs.js +30 -1
  116. package/hashAny.esm.js +30 -1
  117. package/imgEmptyPixel.cjs.js +5 -1
  118. package/imgEmptyPixel.esm.js +5 -1
  119. package/invariant.cjs.js +17 -1
  120. package/invariant.esm.js +17 -1
  121. package/isAbsoluteUrl.cjs.js +5 -1
  122. package/isAbsoluteUrl.esm.js +5 -1
  123. package/isAnyObject.cjs.js +5 -1
  124. package/isAnyObject.esm.js +5 -1
  125. package/isArray.cjs.js +5 -1
  126. package/isArray.esm.js +5 -1
  127. package/isBlob.cjs.js +5 -1
  128. package/isBlob.esm.js +5 -1
  129. package/isBoolean.cjs.js +5 -1
  130. package/isBoolean.esm.js +5 -1
  131. package/isBrowser.cjs.js +4 -1
  132. package/isBrowser.esm.js +4 -1
  133. package/isBrowserNow.cjs.js +4 -1
  134. package/isBrowserNow.esm.js +4 -1
  135. package/isDate.cjs.js +5 -1
  136. package/isDate.esm.js +5 -1
  137. package/isEmptyArray.cjs.js +5 -1
  138. package/isEmptyArray.esm.js +5 -1
  139. package/isEmptyObject.cjs.js +5 -1
  140. package/isEmptyObject.esm.js +5 -1
  141. package/isEmptyString.cjs.js +5 -1
  142. package/isEmptyString.esm.js +5 -1
  143. package/isError.cjs.js +5 -1
  144. package/isError.esm.js +5 -1
  145. package/isExternalUrl.cjs.js +9 -1
  146. package/isExternalUrl.esm.js +9 -1
  147. package/isFile.cjs.js +5 -1
  148. package/isFile.esm.js +5 -1
  149. package/isFloat.cjs.js +5 -1
  150. package/isFloat.esm.js +5 -1
  151. package/isFormData.cjs.js +5 -1
  152. package/isFormData.esm.js +5 -1
  153. package/isFullArray.cjs.js +5 -1
  154. package/isFullArray.esm.js +5 -1
  155. package/isFullObject.cjs.js +5 -1
  156. package/isFullObject.esm.js +5 -1
  157. package/isFullString.cjs.js +5 -1
  158. package/isFullString.esm.js +5 -1
  159. package/isFunction.cjs.js +5 -1
  160. package/isFunction.esm.js +5 -1
  161. package/isInt.cjs.js +5 -1
  162. package/isInt.esm.js +5 -1
  163. package/isMap.cjs.js +5 -1
  164. package/isMap.esm.js +5 -1
  165. package/isNaNValue.cjs.js +5 -1
  166. package/isNaNValue.esm.js +5 -1
  167. package/isNegativeNumber.cjs.js +5 -1
  168. package/isNegativeNumber.esm.js +5 -1
  169. package/isNull.cjs.js +5 -1
  170. package/isNull.esm.js +5 -1
  171. package/isNullOrUndefined.cjs.js +5 -1
  172. package/isNullOrUndefined.esm.js +5 -1
  173. package/isNumber.cjs.js +7 -1
  174. package/isNumber.esm.js +7 -1
  175. package/isNumericLiteral.cjs.js +8 -1
  176. package/isNumericLiteral.esm.js +8 -1
  177. package/isObject.cjs.js +5 -1
  178. package/isObject.esm.js +5 -1
  179. package/isObjectLike.cjs.js +7 -1
  180. package/isObjectLike.esm.js +7 -1
  181. package/isObjectStringKeyed.cjs.js +9 -1
  182. package/isObjectStringKeyed.esm.js +9 -1
  183. package/isOneOf.cjs.js +3 -1
  184. package/isOneOf.esm.js +3 -1
  185. package/isPlainObject.cjs.js +5 -1
  186. package/isPlainObject.esm.js +5 -1
  187. package/isPositiveNumber.cjs.js +5 -1
  188. package/isPositiveNumber.esm.js +5 -1
  189. package/isPrimitive.cjs.js +5 -1
  190. package/isPrimitive.esm.js +5 -1
  191. package/isPromise.cjs.js +5 -1
  192. package/isPromise.esm.js +5 -1
  193. package/isRegExp.cjs.js +5 -1
  194. package/isRegExp.esm.js +5 -1
  195. package/isServer.cjs.js +4 -1
  196. package/isServer.esm.js +4 -1
  197. package/isServerNow.cjs.js +4 -1
  198. package/isServerNow.esm.js +4 -1
  199. package/isSet.cjs.js +5 -1
  200. package/isSet.esm.js +5 -1
  201. package/isString.cjs.js +5 -1
  202. package/isString.esm.js +5 -1
  203. package/isSymbol.cjs.js +5 -1
  204. package/isSymbol.esm.js +5 -1
  205. package/isType.cjs.js +9 -1
  206. package/isType.esm.js +9 -1
  207. package/isUndefined.cjs.js +5 -1
  208. package/isUndefined.esm.js +5 -1
  209. package/isWeakMap.cjs.js +5 -1
  210. package/isWeakMap.esm.js +5 -1
  211. package/isWeakSet.cjs.js +5 -1
  212. package/isWeakSet.esm.js +5 -1
  213. package/kbToBytes.cjs.js +5 -1
  214. package/kbToBytes.esm.js +5 -1
  215. package/lowercase.cjs.js +5 -1
  216. package/lowercase.esm.js +5 -1
  217. package/mapListBy.cjs.js +5 -1
  218. package/mapListBy.esm.js +5 -1
  219. package/matchSorter.cjs.js +90 -1
  220. package/matchSorter.esm.js +90 -1
  221. package/mbToBytes.cjs.js +5 -1
  222. package/mbToBytes.esm.js +5 -1
  223. package/mergeObjects.cjs.js +8 -1
  224. package/mergeObjects.esm.js +8 -1
  225. package/mergeUrlQueryParams.cjs.js +5 -1
  226. package/mergeUrlQueryParams.esm.js +5 -1
  227. package/moveSortableArrayItemByKey.cjs.js +7 -1
  228. package/moveSortableArrayItemByKey.esm.js +7 -1
  229. package/noop.cjs.js +5 -1
  230. package/noop.esm.js +5 -1
  231. package/normaliseUrl.cjs.js +9 -1
  232. package/normaliseUrl.esm.js +9 -1
  233. package/normaliseUrlPathname.cjs.js +8 -1
  234. package/normaliseUrlPathname.esm.js +8 -1
  235. package/objectFlat.cjs.js +8 -1
  236. package/objectFlat.esm.js +8 -1
  237. package/objectFlip.cjs.js +4 -1
  238. package/objectFlip.esm.js +4 -1
  239. package/objectMergeWithDefaults.cjs.js +29 -1
  240. package/objectMergeWithDefaults.esm.js +29 -1
  241. package/objectOmit.cjs.js +9 -1
  242. package/objectOmit.esm.js +9 -1
  243. package/objectPick.cjs.js +6 -1
  244. package/objectPick.esm.js +6 -1
  245. package/objectSort.cjs.js +8 -1
  246. package/objectSort.esm.js +8 -1
  247. package/objectSortByKeysMatching.cjs.js +9 -1
  248. package/objectSortByKeysMatching.esm.js +9 -1
  249. package/objectToArray.cjs.js +6 -1
  250. package/objectToArray.esm.js +6 -1
  251. package/package.json +1 -1
  252. package/parseCookie.cjs.js +13 -1
  253. package/parseCookie.esm.js +13 -1
  254. package/parseURL.cjs.js +6 -1
  255. package/parseURL.esm.js +6 -1
  256. package/quaranteneProps.cjs.js +17 -1
  257. package/quaranteneProps.esm.js +17 -1
  258. package/randomInt.cjs.js +5 -1
  259. package/randomInt.esm.js +5 -1
  260. package/randomKey.cjs.js +6 -1
  261. package/randomKey.esm.js +6 -1
  262. package/readCookie.cjs.js +5 -1
  263. package/readCookie.esm.js +5 -1
  264. package/removeAccents.cjs.js +3 -1
  265. package/removeAccents.esm.js +3 -1
  266. package/removeCookie.cjs.js +3 -1
  267. package/removeCookie.esm.js +3 -1
  268. package/removeDuplicates.cjs.js +8 -1
  269. package/removeDuplicates.esm.js +8 -1
  270. package/removeDuplicatesByKey.cjs.js +6 -1
  271. package/removeDuplicatesByKey.esm.js +6 -1
  272. package/removeDuplicatesComparing.cjs.js +3 -1
  273. package/removeDuplicatesComparing.esm.js +3 -1
  274. package/removeIndexesFromArray.cjs.js +4 -1
  275. package/removeIndexesFromArray.esm.js +4 -1
  276. package/removeTrailingSlash.cjs.js +5 -1
  277. package/removeTrailingSlash.esm.js +5 -1
  278. package/removeUrlQueryParams.cjs.js +5 -1
  279. package/removeUrlQueryParams.esm.js +5 -1
  280. package/render.cjs.js +52 -1
  281. package/render.esm.js +52 -1
  282. package/round.cjs.js +11 -1
  283. package/round.esm.js +11 -1
  284. package/roundTo.cjs.js +22 -1
  285. package/roundTo.esm.js +22 -1
  286. package/serializeCookie.cjs.js +13 -1
  287. package/serializeCookie.esm.js +13 -1
  288. package/setCookie.cjs.js +11 -1
  289. package/setCookie.esm.js +11 -1
  290. package/shuffle.cjs.js +15 -1
  291. package/shuffle.esm.js +15 -1
  292. package/slugify.cjs.js +19 -1
  293. package/slugify.esm.js +19 -1
  294. package/split.cjs.js +6 -1
  295. package/split.esm.js +6 -1
  296. package/splitReverse.cjs.js +6 -1
  297. package/splitReverse.esm.js +6 -1
  298. package/swapMap.cjs.js +5 -1
  299. package/swapMap.esm.js +5 -1
  300. package/throttle.cjs.js +6 -1
  301. package/throttle.esm.js +6 -1
  302. package/toNumber.cjs.js +5 -1
  303. package/toNumber.esm.js +5 -1
  304. package/toRgba.cjs.js +5 -1
  305. package/toRgba.esm.js +5 -1
  306. package/transformToUrlPathname.cjs.js +9 -1
  307. package/transformToUrlPathname.esm.js +9 -1
  308. package/truncate.cjs.js +5 -1
  309. package/truncate.esm.js +5 -1
  310. package/tryUntil.cjs.js +14 -1
  311. package/tryUntil.esm.js +14 -1
  312. package/uid.cjs.js +5 -1
  313. package/uid.esm.js +5 -1
  314. package/updateLinkParams.cjs.js +7 -1
  315. package/updateLinkParams.esm.js +7 -1
  316. package/updateUrlQueryParams.cjs.js +5 -1
  317. package/updateUrlQueryParams.esm.js +5 -1
  318. package/uppercase.cjs.js +6 -1
  319. package/uppercase.esm.js +6 -1
  320. package/uuid.cjs.js +6 -1
  321. package/uuid.esm.js +6 -1
  322. package/uuidNumeric.cjs.js +4 -1
  323. package/uuidNumeric.esm.js +4 -1
  324. package/wait.cjs.js +5 -1
  325. package/wait.esm.js +5 -1
@@ -1,6 +1,9 @@
1
1
  import { isUndefined } from './isUndefined.esm.js';
2
2
  import './getType.esm.js';
3
3
 
4
- let isServerNow=()=>isUndefined(window);
4
+ /**
5
+ * @category ssr
6
+ * @category is
7
+ */let isServerNow=()=>isUndefined(window);
5
8
 
6
9
  export { isServerNow as default, isServerNow };
package/isSet.cjs.js CHANGED
@@ -4,7 +4,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var getType = require('./getType.cjs.js');
6
6
 
7
- let isSet=t=>"Set"===getType.getType(t);
7
+ /**
8
+ * Returns whether the payload is a Set
9
+ *
10
+ * @category is
11
+ */let isSet=t=>"Set"===getType.getType(t);
8
12
 
9
13
  exports["default"] = isSet;
10
14
  exports.isSet = isSet;
package/isSet.esm.js CHANGED
@@ -1,5 +1,9 @@
1
1
  import { getType } from './getType.esm.js';
2
2
 
3
- let isSet=t=>"Set"===getType(t);
3
+ /**
4
+ * Returns whether the payload is a Set
5
+ *
6
+ * @category is
7
+ */let isSet=t=>"Set"===getType(t);
4
8
 
5
9
  export { isSet as default, isSet };
package/isString.cjs.js CHANGED
@@ -4,7 +4,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var getType = require('./getType.cjs.js');
6
6
 
7
- let isString=r=>"String"===getType.getType(r);
7
+ /**
8
+ * Returns whether the payload is a string
9
+ *
10
+ * @category is
11
+ */let isString=r=>"String"===getType.getType(r);
8
12
 
9
13
  exports["default"] = isString;
10
14
  exports.isString = isString;
package/isString.esm.js CHANGED
@@ -1,5 +1,9 @@
1
1
  import { getType } from './getType.esm.js';
2
2
 
3
- let isString=r=>"String"===getType(r);
3
+ /**
4
+ * Returns whether the payload is a string
5
+ *
6
+ * @category is
7
+ */let isString=r=>"String"===getType(r);
4
8
 
5
9
  export { isString as default, isString };
package/isSymbol.cjs.js CHANGED
@@ -4,7 +4,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var getType = require('./getType.cjs.js');
6
6
 
7
- let isSymbol=e=>"Symbol"===getType.getType(e);
7
+ /**
8
+ * Returns whether the payload is a Symbol
9
+ *
10
+ * @category is
11
+ */let isSymbol=e=>"Symbol"===getType.getType(e);
8
12
 
9
13
  exports["default"] = isSymbol;
10
14
  exports.isSymbol = isSymbol;
package/isSymbol.esm.js CHANGED
@@ -1,5 +1,9 @@
1
1
  import { getType } from './getType.esm.js';
2
2
 
3
- let isSymbol=e=>"Symbol"===getType(e);
3
+ /**
4
+ * Returns whether the payload is a Symbol
5
+ *
6
+ * @category is
7
+ */let isSymbol=e=>"Symbol"===getType(e);
4
8
 
5
9
  export { isSymbol as default, isSymbol };
package/isType.cjs.js CHANGED
@@ -4,7 +4,15 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var getType = require('./getType.cjs.js');
6
6
 
7
- let isType=(e,r)=>{if(!(r instanceof Function))throw TypeError("Type must be a function");if(!Object.prototype.hasOwnProperty.call(r,"prototype"))throw TypeError("Type is not a class");let o=r.name;return getType.getType(e)===o||!!(e&&e.constructor===r)};
7
+ /**
8
+ * Does a generic check to check that the given payload is of a given type.
9
+ * In cases like Number, it will return true for NaN as NaN is a Number (thanks javascript!);
10
+ * It will, however, differentiate between object and null
11
+ *
12
+ * @category is
13
+ * @throws {TypeError} Will throw type error if type is an invalid type
14
+ */let isType=(e,r)=>{if(!(r instanceof Function))throw TypeError("Type must be a function");if(!Object.prototype.hasOwnProperty.call(r,"prototype"))throw TypeError("Type is not a class");// Classes usually have names (as functions usually have names)
15
+ let o=r.name;return getType.getType(e)===o||!!(e&&e.constructor===r)};
8
16
 
9
17
  exports["default"] = isType;
10
18
  exports.isType = isType;
package/isType.esm.js CHANGED
@@ -1,5 +1,13 @@
1
1
  import { getType } from './getType.esm.js';
2
2
 
3
- let isType=(e,r)=>{if(!(r instanceof Function))throw TypeError("Type must be a function");if(!Object.prototype.hasOwnProperty.call(r,"prototype"))throw TypeError("Type is not a class");let o=r.name;return getType(e)===o||!!(e&&e.constructor===r)};
3
+ /**
4
+ * Does a generic check to check that the given payload is of a given type.
5
+ * In cases like Number, it will return true for NaN as NaN is a Number (thanks javascript!);
6
+ * It will, however, differentiate between object and null
7
+ *
8
+ * @category is
9
+ * @throws {TypeError} Will throw type error if type is an invalid type
10
+ */let isType=(e,r)=>{if(!(r instanceof Function))throw TypeError("Type must be a function");if(!Object.prototype.hasOwnProperty.call(r,"prototype"))throw TypeError("Type is not a class");// Classes usually have names (as functions usually have names)
11
+ let o=r.name;return getType(e)===o||!!(e&&e.constructor===r)};
4
12
 
5
13
  export { isType as default, isType };
@@ -4,7 +4,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var getType = require('./getType.cjs.js');
6
6
 
7
- let isUndefined=d=>"Undefined"===getType.getType(d);
7
+ /**
8
+ * Returns whether the payload is undefined
9
+ *
10
+ * @category is
11
+ */let isUndefined=d=>"Undefined"===getType.getType(d);
8
12
 
9
13
  exports["default"] = isUndefined;
10
14
  exports.isUndefined = isUndefined;
@@ -1,5 +1,9 @@
1
1
  import { getType } from './getType.esm.js';
2
2
 
3
- let isUndefined=d=>"Undefined"===getType(d);
3
+ /**
4
+ * Returns whether the payload is undefined
5
+ *
6
+ * @category is
7
+ */let isUndefined=d=>"Undefined"===getType(d);
4
8
 
5
9
  export { isUndefined as default, isUndefined };
package/isWeakMap.cjs.js CHANGED
@@ -4,7 +4,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var getType = require('./getType.cjs.js');
6
6
 
7
- let isWeakMap=a=>"WeakMap"===getType.getType(a);
7
+ /**
8
+ * Returns whether the payload is a WeakMap
9
+ *
10
+ * @category is
11
+ */let isWeakMap=a=>"WeakMap"===getType.getType(a);
8
12
 
9
13
  exports["default"] = isWeakMap;
10
14
  exports.isWeakMap = isWeakMap;
package/isWeakMap.esm.js CHANGED
@@ -1,5 +1,9 @@
1
1
  import { getType } from './getType.esm.js';
2
2
 
3
- let isWeakMap=a=>"WeakMap"===getType(a);
3
+ /**
4
+ * Returns whether the payload is a WeakMap
5
+ *
6
+ * @category is
7
+ */let isWeakMap=a=>"WeakMap"===getType(a);
4
8
 
5
9
  export { isWeakMap as default, isWeakMap };
package/isWeakSet.cjs.js CHANGED
@@ -4,7 +4,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var getType = require('./getType.cjs.js');
6
6
 
7
- let isWeakSet=t=>"WeakSet"===getType.getType(t);
7
+ /**
8
+ * Returns whether the payload is a WeakSet
9
+ *
10
+ * @category is
11
+ */let isWeakSet=t=>"WeakSet"===getType.getType(t);
8
12
 
9
13
  exports["default"] = isWeakSet;
10
14
  exports.isWeakSet = isWeakSet;
package/isWeakSet.esm.js CHANGED
@@ -1,5 +1,9 @@
1
1
  import { getType } from './getType.esm.js';
2
2
 
3
- let isWeakSet=t=>"WeakSet"===getType(t);
3
+ /**
4
+ * Returns whether the payload is a WeakSet
5
+ *
6
+ * @category is
7
+ */let isWeakSet=t=>"WeakSet"===getType(t);
4
8
 
5
9
  export { isWeakSet as default, isWeakSet };
package/kbToBytes.cjs.js CHANGED
@@ -2,7 +2,11 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- let kbToBytes=e=>1e3*e;
5
+ /**
6
+ * Kilobytes to bytes
7
+ *
8
+ * @category format
9
+ */let kbToBytes=e=>1e3*e;
6
10
 
7
11
  exports["default"] = kbToBytes;
8
12
  exports.kbToBytes = kbToBytes;
package/kbToBytes.esm.js CHANGED
@@ -1,3 +1,7 @@
1
- let kbToBytes=e=>1e3*e;
1
+ /**
2
+ * Kilobytes to bytes
3
+ *
4
+ * @category format
5
+ */let kbToBytes=e=>1e3*e;
2
6
 
3
7
  export { kbToBytes as default, kbToBytes };
package/lowercase.cjs.js CHANGED
@@ -2,7 +2,11 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- let lowercase=e=>(e||"").toLowerCase();
5
+ /**
6
+ * Replacement for native `toLowercase` tyescript ready (type narrowing ready)
7
+ *
8
+ * @category native
9
+ */let lowercase=e=>(e||"").toLowerCase();
6
10
 
7
11
  exports["default"] = lowercase;
8
12
  exports.lowercase = lowercase;
package/lowercase.esm.js CHANGED
@@ -1,3 +1,7 @@
1
- let lowercase=e=>(e||"").toLowerCase();
1
+ /**
2
+ * Replacement for native `toLowercase` tyescript ready (type narrowing ready)
3
+ *
4
+ * @category native
5
+ */let lowercase=e=>(e||"").toLowerCase();
2
6
 
3
7
  export { lowercase as default, lowercase };
package/mapListBy.cjs.js CHANGED
@@ -2,7 +2,11 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- let mapListBy=(e=[],t="")=>e.reduce((e,p)=>(e[p[t]]=p,e),{});
5
+ /**
6
+ * Maps an array of objects into a map keyed with the given key
7
+ *
8
+ * @category array
9
+ */let mapListBy=(e=[],t="")=>e.reduce((e,p)=>(e[p[t]]=p,e),{});
6
10
 
7
11
  exports["default"] = mapListBy;
8
12
  exports.mapListBy = mapListBy;
package/mapListBy.esm.js CHANGED
@@ -1,3 +1,7 @@
1
- let mapListBy=(e=[],t="")=>e.reduce((e,p)=>(e[p[t]]=p,e),{});
1
+ /**
2
+ * Maps an array of objects into a map keyed with the given key
3
+ *
4
+ * @category array
5
+ */let mapListBy=(e=[],t="")=>e.reduce((e,p)=>(e[p[t]]=p,e),{});
2
6
 
3
7
  export { mapListBy as default, mapListBy };
@@ -7,7 +7,96 @@ var removeAccents = require('./removeAccents.cjs.js');
7
7
  require('./getType.cjs.js');
8
8
  require('./accentsSets.cjs.js');
9
9
 
10
- let r=(e,t)=>String(e.rankedValue).localeCompare(String(t.rankedValue)),l=(e,t,l={})=>{let{keys:u,threshold:a=1,baseSort:o=r,sorter:s=e=>e.sort((e,t)=>i(e,t,o))}=l;return s(e.reduce(function(e,r,o){let i=n(r,u,t,l),{rank:s,keyThreshold:h=a}=i;return s>=h&&e.push({...i,item:r,index:o}),e},[])).map(({item:e})=>e)},n=(e,t,r,l)=>t?c(e,t).reduce(({rank:e,rankedValue:t,keyIndex:n,keyThreshold:a},{itemValue:o,attributes:i},s)=>{let h=u(o,r,l),f=t,{minRanking:c,maxRanking:d,threshold:k}=i;return h<c&&h>=1?h=c:h>d&&(h=d),h>e&&(e=h,n=s,a=k,f=o),{rankedValue:f,rank:e,keyIndex:n,keyThreshold:a}},{rankedValue:e,rank:0,keyIndex:-1,keyThreshold:l.threshold}):{rankedValue:e,rank:u(e,r,l),keyIndex:-1,keyThreshold:l.threshold},u=(e,t,r)=>(e=s(e,r),(t=s(t,r)).length>e.length)?0:e===t?7:(e=e.toLowerCase())===(t=t.toLowerCase())?6:e.startsWith(t)?5:e.includes(` ${t}`)?4:e.includes(t)?3:1===t.length?0:a(e).includes(t)?2:o(e,t),a=e=>{let t="";return e.split(" ").forEach(e=>{e.split("-").forEach(e=>{t+=e.substring(0,1);});}),t},o=(e,t)=>{let r=0,l=0;function n(e,t,l){for(let n=l,u=t.length;n<u;n++)if(t[n]===e)return r+=1,n+1;return -1}let u=n(t[0],e,0);if(u<0)return 0;l=u;for(let r=1,u=t.length;r<u;r++)if(!((l=n(t[r],e,l))>-1))return 0;return 1+1/(l-u)*(r/t.length)},i=(e,t,r)=>{let{rank:l,keyIndex:n}=e,{rank:u,keyIndex:a}=t;return l!==u?l>u?-1:1:n===a?r(e,t):n<a?-1:1},s=(e,{keepDiacritics:r})=>(e=`${e}`,r||(e=removeAccents.removeAccents(e)),e),h=(e,t)=>{let r;if("object"==typeof t&&(t=t.key),"function"==typeof t)r=t(e);else if(null==e)r=null;else if(Object.hasOwnProperty.call(e,t))r=e[t];else {if(t.includes("."))return f(t,e);r=null;}return null==r?[]:Array.isArray(r)?r:[String(r)]},f=(e,t)=>{let r=e.split("."),l=[t];for(let e=0,t=r.length;e<t;e++){let t=r[e],n=[];for(let e=0,r=l.length;e<r;e++){let r=l[e];if(null!=r){if(Object.hasOwnProperty.call(r,t)){let e=r[t];null!=e&&n.push(e);}else "*"===t&&(n=n.concat(r));}}l=n;}return Array.isArray(l[0])?[].concat(...l):l},c=(e,t)=>{let r=[];for(let l=0,n=t.length;l<n;l++){let n=t[l],u=k(n),a=h(e,n);for(let e=0,t=a.length;e<t;e++)r.push({itemValue:a[e],attributes:u});}return r},d={maxRanking:1/0,minRanking:-1/0},k=t=>isString.isString(t)?d:{...d,...t};
10
+ let r=(e,t)=>String(e.rankedValue).localeCompare(String(t.rankedValue)),/**
11
+ * Takes an array of items and a value and returns a new array with the items that match the given value
12
+ * @param {Array} items - the items to sort
13
+ * @param {String} value - the value to use for ranking
14
+ * @param {Object} options - Some options to configure the sorter
15
+ * @return {Array} - the new sorted array
16
+ */l=(e,t,l={})=>{let{keys:u,threshold:a=1,baseSort:o=r,sorter:s=e=>e.sort((e,t)=>i(e,t,o))}=l;return s(e.reduce(function(e,r,o){let i=n(r,u,t,l),{rank:s,keyThreshold:h=a}=i;return s>=h&&e.push({...i,item:r,index:o}),e},[])).map(({item:e})=>e)},/**
17
+ * Gets the highest ranking for value for the given item based on its values for the given keys
18
+ * @param {*} item - the item to rank
19
+ * @param {Array} keys - the keys to get values from the item for the ranking
20
+ * @param {String} value - the value to rank against
21
+ * @param {Object} options - options to control the ranking
22
+ * @return {{rank: Number, keyIndex: Number, keyThreshold: Number}} - the highest ranking
23
+ */n=(e,t,r,l)=>t?c(e,t).reduce(({rank:e,rankedValue:t,keyIndex:n,keyThreshold:a},{itemValue:o,attributes:i},s)=>{let h=u(o,r,l),f=t,{minRanking:c,maxRanking:d,threshold:k}=i;return h<c&&h>=1?h=c:h>d&&(h=d),h>e&&(e=h,n=s,a=k,f=o),{rankedValue:f,rank:e,keyIndex:n,keyThreshold:a}},{rankedValue:e,rank:0,keyIndex:-1,keyThreshold:l.threshold}):{// ends up being duplicate of 'item' in matches but consistent
24
+ rankedValue:// if keys is not specified, then we assume the item given is ready to be matched
25
+ e,rank:u(e,r,l),keyIndex:-1,keyThreshold:l.threshold},/**
26
+ * Gives a rankings score based on how well the two strings match.
27
+ * @param {String} testString - the string to test against
28
+ * @param {String} stringToRank - the string to rank
29
+ * @param {Object} options - options for the match (like keepDiacritics for comparison)
30
+ * @returns {Number} the ranking for how well stringToRank matches testString
31
+ */u=(e,t,r)=>// too long
32
+ (e=s(e,r),(t=s(t,r)).length>e.length)?0:// case sensitive equals
33
+ e===t?7:// case insensitive equals
34
+ // Lower casing before further comparison
35
+ (e=e.toLowerCase())===(t=t.toLowerCase())?6:// starts with
36
+ e.startsWith(t)?5:// word starts with
37
+ e.includes(` ${t}`)?4:// contains
38
+ e.includes(t)?3:1===t.length?0:// If the only character in the given stringToRank
39
+ // isn't even contained in the testString, then
40
+ // it's definitely not a match.
41
+ // acronym
42
+ a(e).includes(t)?2:// will return a number between RANKING_MATCHES and
43
+ // RANKING_MATCHES + 1 depending on how close of a match it is.
44
+ o(e,t),/**
45
+ * Generates an acronym for a string.
46
+ *
47
+ * @param {String} string the string for which to produce the acronym
48
+ * @returns {String} the acronym
49
+ */a=e=>{let t="";return e.split(" ").forEach(e=>{e.split("-").forEach(e=>{t+=e.substring(0,1);});}),t},/**
50
+ * Returns a score based on how spread apart the
51
+ * characters from the stringToRank are within the testString.
52
+ * A number close to RANKING_MATCHES represents a loose match. A number close
53
+ * to RANKING_MATCHES + 1 represents a tighter match.
54
+ * @param {String} testString - the string to test against
55
+ * @param {String} stringToRank - the string to rank
56
+ * @returns {Number} the number between RANKING_MATCHES and
57
+ * RANKING_MATCHES + 1 for how well stringToRank matches testString
58
+ */o=(e,t)=>{let r=0,l=0;function n(e,t,l){for(let n=l,u=t.length;n<u;n++)if(t[n]===e)return r+=1,n+1;return -1}let u=n(t[0],e,0);if(u<0)return 0;l=u;for(let r=1,u=t.length;r<u;r++)if(!((l=n(t[r],e,l))>-1))return 0;return 1+1/(l-u)*(r/t.length)},/**
59
+ * Sorts items that have a rank, index, and keyIndex
60
+ * @param {Object} a - the first item to sort
61
+ * @param {Object} b - the second item to sort
62
+ * @return {Number} -1 if a should come first, 1 if b should come first, 0 if equal
63
+ */i=(e,t,r)=>{let{rank:l,keyIndex:n}=e,{rank:u,keyIndex:a}=t;return l!==u?l>u?-1:1:n===a?// use the base sort function as a tie-breaker
64
+ r(e,t):n<a?-1:1},/**
65
+ * Prepares value for comparison by stringifying it, removing diacritics (if specified)
66
+ * @param {String} value - the value to clean
67
+ * @param {Object} options - {keepDiacritics: whether to remove diacritics}
68
+ * @return {String} the prepared value
69
+ */s=(e,{keepDiacritics:r})=>(// value might not actually be a string at this point (we don't get to choose)
70
+ // so part of preparing the value for comparison is ensure that it is a string
71
+ e=`${e}`,// toString
72
+ r||(e=removeAccents.removeAccents(e)),e),/**
73
+ * Gets value for key in item at arbitrarily nested keypath
74
+ * @param {Object} item - the item
75
+ * @param {Object|Function} key - the potentially nested keypath or property callback
76
+ * @return {Array} - an array containing the value(s) at the nested keypath
77
+ */h=(e,t)=>{let r;if("object"==typeof t&&(t=t.key),"function"==typeof t)r=t(e);else if(null==e)r=null;else if(Object.hasOwnProperty.call(e,t))r=e[t];else {if(t.includes("."))// eslint-disable-next-line @typescript-eslint/no-unsafe-call
78
+ return f(t,e);r=null;}return(// because `value` can also be undefined
79
+ null==r?[]:Array.isArray(r)?r:[String(r)])},/**
80
+ * Given path: "foo.bar.baz"
81
+ * And item: {foo: {bar: {baz: 'buzz'}}}
82
+ * -> 'buzz'
83
+ * @param path a dot-separated set of keys
84
+ * @param item the item to get the value from
85
+ */f=(e,t)=>{let r=e.split("."),l=[t];for(let e=0,t=r.length;e<t;e++){let t=r[e],n=[];for(let e=0,r=l.length;e<r;e++){let r=l[e];if(null!=r){if(Object.hasOwnProperty.call(r,t)){let e=r[t];null!=e&&n.push(e);}else "*"===t&&// ensure that values is an array
86
+ (n=n.concat(r));}}l=n;}return Array.isArray(l[0])?// keep allowing the implicit wildcard for an array of strings at the end of
87
+ // the path; don't use `.flat()` because that's not available in node.js v10
88
+ [].concat(...l):// Based on our logic it should be an array of strings by now...
89
+ // assuming the user's path terminated in strings
90
+ l},/**
91
+ * Gets all the values for the given keys in the given item and returns an array of those values
92
+ * @param item - the item from which the values will be retrieved
93
+ * @param keys - the keys to use to retrieve the values
94
+ * @return objects with {itemValue, attributes}
95
+ */c=(e,t)=>{let r=[];for(let l=0,n=t.length;l<n;l++){let n=t[l],u=k(n),a=h(e,n);for(let e=0,t=a.length;e<t;e++)r.push({itemValue:a[e],attributes:u});}return r},d={maxRanking:1/0,minRanking:-1/0},/**
96
+ * Gets all the attributes for the given key
97
+ * @param key - the key from which the attributes will be retrieved
98
+ * @return object containing the key's attributes
99
+ */k=t=>isString.isString(t)?d:{...d,...t};
11
100
 
12
101
  exports["default"] = l;
13
102
  exports.defaultBaseSortFn = r;
@@ -3,6 +3,95 @@ import { removeAccents } from './removeAccents.esm.js';
3
3
  import './getType.esm.js';
4
4
  import './accentsSets.esm.js';
5
5
 
6
- let r=(e,t)=>String(e.rankedValue).localeCompare(String(t.rankedValue)),l=(e,t,l={})=>{let{keys:u,threshold:a=1,baseSort:o=r,sorter:s=e=>e.sort((e,t)=>i(e,t,o))}=l;return s(e.reduce(function(e,r,o){let i=n(r,u,t,l),{rank:s,keyThreshold:h=a}=i;return s>=h&&e.push({...i,item:r,index:o}),e},[])).map(({item:e})=>e)},n=(e,t,r,l)=>t?c(e,t).reduce(({rank:e,rankedValue:t,keyIndex:n,keyThreshold:a},{itemValue:o,attributes:i},s)=>{let h=u(o,r,l),f=t,{minRanking:c,maxRanking:d,threshold:k}=i;return h<c&&h>=1?h=c:h>d&&(h=d),h>e&&(e=h,n=s,a=k,f=o),{rankedValue:f,rank:e,keyIndex:n,keyThreshold:a}},{rankedValue:e,rank:0,keyIndex:-1,keyThreshold:l.threshold}):{rankedValue:e,rank:u(e,r,l),keyIndex:-1,keyThreshold:l.threshold},u=(e,t,r)=>(e=s(e,r),(t=s(t,r)).length>e.length)?0:e===t?7:(e=e.toLowerCase())===(t=t.toLowerCase())?6:e.startsWith(t)?5:e.includes(` ${t}`)?4:e.includes(t)?3:1===t.length?0:a(e).includes(t)?2:o(e,t),a=e=>{let t="";return e.split(" ").forEach(e=>{e.split("-").forEach(e=>{t+=e.substring(0,1);});}),t},o=(e,t)=>{let r=0,l=0;function n(e,t,l){for(let n=l,u=t.length;n<u;n++)if(t[n]===e)return r+=1,n+1;return -1}let u=n(t[0],e,0);if(u<0)return 0;l=u;for(let r=1,u=t.length;r<u;r++)if(!((l=n(t[r],e,l))>-1))return 0;return 1+1/(l-u)*(r/t.length)},i=(e,t,r)=>{let{rank:l,keyIndex:n}=e,{rank:u,keyIndex:a}=t;return l!==u?l>u?-1:1:n===a?r(e,t):n<a?-1:1},s=(e,{keepDiacritics:r})=>(e=`${e}`,r||(e=removeAccents(e)),e),h=(e,t)=>{let r;if("object"==typeof t&&(t=t.key),"function"==typeof t)r=t(e);else if(null==e)r=null;else if(Object.hasOwnProperty.call(e,t))r=e[t];else {if(t.includes("."))return f(t,e);r=null;}return null==r?[]:Array.isArray(r)?r:[String(r)]},f=(e,t)=>{let r=e.split("."),l=[t];for(let e=0,t=r.length;e<t;e++){let t=r[e],n=[];for(let e=0,r=l.length;e<r;e++){let r=l[e];if(null!=r){if(Object.hasOwnProperty.call(r,t)){let e=r[t];null!=e&&n.push(e);}else "*"===t&&(n=n.concat(r));}}l=n;}return Array.isArray(l[0])?[].concat(...l):l},c=(e,t)=>{let r=[];for(let l=0,n=t.length;l<n;l++){let n=t[l],u=k(n),a=h(e,n);for(let e=0,t=a.length;e<t;e++)r.push({itemValue:a[e],attributes:u});}return r},d={maxRanking:1/0,minRanking:-1/0},k=t=>isString(t)?d:{...d,...t};
6
+ let r=(e,t)=>String(e.rankedValue).localeCompare(String(t.rankedValue)),/**
7
+ * Takes an array of items and a value and returns a new array with the items that match the given value
8
+ * @param {Array} items - the items to sort
9
+ * @param {String} value - the value to use for ranking
10
+ * @param {Object} options - Some options to configure the sorter
11
+ * @return {Array} - the new sorted array
12
+ */l=(e,t,l={})=>{let{keys:u,threshold:a=1,baseSort:o=r,sorter:s=e=>e.sort((e,t)=>i(e,t,o))}=l;return s(e.reduce(function(e,r,o){let i=n(r,u,t,l),{rank:s,keyThreshold:h=a}=i;return s>=h&&e.push({...i,item:r,index:o}),e},[])).map(({item:e})=>e)},/**
13
+ * Gets the highest ranking for value for the given item based on its values for the given keys
14
+ * @param {*} item - the item to rank
15
+ * @param {Array} keys - the keys to get values from the item for the ranking
16
+ * @param {String} value - the value to rank against
17
+ * @param {Object} options - options to control the ranking
18
+ * @return {{rank: Number, keyIndex: Number, keyThreshold: Number}} - the highest ranking
19
+ */n=(e,t,r,l)=>t?c(e,t).reduce(({rank:e,rankedValue:t,keyIndex:n,keyThreshold:a},{itemValue:o,attributes:i},s)=>{let h=u(o,r,l),f=t,{minRanking:c,maxRanking:d,threshold:k}=i;return h<c&&h>=1?h=c:h>d&&(h=d),h>e&&(e=h,n=s,a=k,f=o),{rankedValue:f,rank:e,keyIndex:n,keyThreshold:a}},{rankedValue:e,rank:0,keyIndex:-1,keyThreshold:l.threshold}):{// ends up being duplicate of 'item' in matches but consistent
20
+ rankedValue:// if keys is not specified, then we assume the item given is ready to be matched
21
+ e,rank:u(e,r,l),keyIndex:-1,keyThreshold:l.threshold},/**
22
+ * Gives a rankings score based on how well the two strings match.
23
+ * @param {String} testString - the string to test against
24
+ * @param {String} stringToRank - the string to rank
25
+ * @param {Object} options - options for the match (like keepDiacritics for comparison)
26
+ * @returns {Number} the ranking for how well stringToRank matches testString
27
+ */u=(e,t,r)=>// too long
28
+ (e=s(e,r),(t=s(t,r)).length>e.length)?0:// case sensitive equals
29
+ e===t?7:// case insensitive equals
30
+ // Lower casing before further comparison
31
+ (e=e.toLowerCase())===(t=t.toLowerCase())?6:// starts with
32
+ e.startsWith(t)?5:// word starts with
33
+ e.includes(` ${t}`)?4:// contains
34
+ e.includes(t)?3:1===t.length?0:// If the only character in the given stringToRank
35
+ // isn't even contained in the testString, then
36
+ // it's definitely not a match.
37
+ // acronym
38
+ a(e).includes(t)?2:// will return a number between RANKING_MATCHES and
39
+ // RANKING_MATCHES + 1 depending on how close of a match it is.
40
+ o(e,t),/**
41
+ * Generates an acronym for a string.
42
+ *
43
+ * @param {String} string the string for which to produce the acronym
44
+ * @returns {String} the acronym
45
+ */a=e=>{let t="";return e.split(" ").forEach(e=>{e.split("-").forEach(e=>{t+=e.substring(0,1);});}),t},/**
46
+ * Returns a score based on how spread apart the
47
+ * characters from the stringToRank are within the testString.
48
+ * A number close to RANKING_MATCHES represents a loose match. A number close
49
+ * to RANKING_MATCHES + 1 represents a tighter match.
50
+ * @param {String} testString - the string to test against
51
+ * @param {String} stringToRank - the string to rank
52
+ * @returns {Number} the number between RANKING_MATCHES and
53
+ * RANKING_MATCHES + 1 for how well stringToRank matches testString
54
+ */o=(e,t)=>{let r=0,l=0;function n(e,t,l){for(let n=l,u=t.length;n<u;n++)if(t[n]===e)return r+=1,n+1;return -1}let u=n(t[0],e,0);if(u<0)return 0;l=u;for(let r=1,u=t.length;r<u;r++)if(!((l=n(t[r],e,l))>-1))return 0;return 1+1/(l-u)*(r/t.length)},/**
55
+ * Sorts items that have a rank, index, and keyIndex
56
+ * @param {Object} a - the first item to sort
57
+ * @param {Object} b - the second item to sort
58
+ * @return {Number} -1 if a should come first, 1 if b should come first, 0 if equal
59
+ */i=(e,t,r)=>{let{rank:l,keyIndex:n}=e,{rank:u,keyIndex:a}=t;return l!==u?l>u?-1:1:n===a?// use the base sort function as a tie-breaker
60
+ r(e,t):n<a?-1:1},/**
61
+ * Prepares value for comparison by stringifying it, removing diacritics (if specified)
62
+ * @param {String} value - the value to clean
63
+ * @param {Object} options - {keepDiacritics: whether to remove diacritics}
64
+ * @return {String} the prepared value
65
+ */s=(e,{keepDiacritics:r})=>(// value might not actually be a string at this point (we don't get to choose)
66
+ // so part of preparing the value for comparison is ensure that it is a string
67
+ e=`${e}`,// toString
68
+ r||(e=removeAccents(e)),e),/**
69
+ * Gets value for key in item at arbitrarily nested keypath
70
+ * @param {Object} item - the item
71
+ * @param {Object|Function} key - the potentially nested keypath or property callback
72
+ * @return {Array} - an array containing the value(s) at the nested keypath
73
+ */h=(e,t)=>{let r;if("object"==typeof t&&(t=t.key),"function"==typeof t)r=t(e);else if(null==e)r=null;else if(Object.hasOwnProperty.call(e,t))r=e[t];else {if(t.includes("."))// eslint-disable-next-line @typescript-eslint/no-unsafe-call
74
+ return f(t,e);r=null;}return(// because `value` can also be undefined
75
+ null==r?[]:Array.isArray(r)?r:[String(r)])},/**
76
+ * Given path: "foo.bar.baz"
77
+ * And item: {foo: {bar: {baz: 'buzz'}}}
78
+ * -> 'buzz'
79
+ * @param path a dot-separated set of keys
80
+ * @param item the item to get the value from
81
+ */f=(e,t)=>{let r=e.split("."),l=[t];for(let e=0,t=r.length;e<t;e++){let t=r[e],n=[];for(let e=0,r=l.length;e<r;e++){let r=l[e];if(null!=r){if(Object.hasOwnProperty.call(r,t)){let e=r[t];null!=e&&n.push(e);}else "*"===t&&// ensure that values is an array
82
+ (n=n.concat(r));}}l=n;}return Array.isArray(l[0])?// keep allowing the implicit wildcard for an array of strings at the end of
83
+ // the path; don't use `.flat()` because that's not available in node.js v10
84
+ [].concat(...l):// Based on our logic it should be an array of strings by now...
85
+ // assuming the user's path terminated in strings
86
+ l},/**
87
+ * Gets all the values for the given keys in the given item and returns an array of those values
88
+ * @param item - the item from which the values will be retrieved
89
+ * @param keys - the keys to use to retrieve the values
90
+ * @return objects with {itemValue, attributes}
91
+ */c=(e,t)=>{let r=[];for(let l=0,n=t.length;l<n;l++){let n=t[l],u=k(n),a=h(e,n);for(let e=0,t=a.length;e<t;e++)r.push({itemValue:a[e],attributes:u});}return r},d={maxRanking:1/0,minRanking:-1/0},/**
92
+ * Gets all the attributes for the given key
93
+ * @param key - the key from which the attributes will be retrieved
94
+ * @return object containing the key's attributes
95
+ */k=t=>isString(t)?d:{...d,...t};
7
96
 
8
97
  export { l as default, r as defaultBaseSortFn, l as matchSorter };
package/mbToBytes.cjs.js CHANGED
@@ -2,7 +2,11 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- let mbToBytes=e=>1e6*e;
5
+ /**
6
+ * Megabytes to bytes
7
+ *
8
+ * @category format
9
+ */let mbToBytes=e=>1e6*e;
6
10
 
7
11
  exports["default"] = mbToBytes;
8
12
  exports.mbToBytes = mbToBytes;
package/mbToBytes.esm.js CHANGED
@@ -1,3 +1,7 @@
1
- let mbToBytes=e=>1e6*e;
1
+ /**
2
+ * Megabytes to bytes
3
+ *
4
+ * @category format
5
+ */let mbToBytes=e=>1e6*e;
2
6
 
3
7
  export { mbToBytes as default, mbToBytes };
@@ -7,7 +7,14 @@ var isUndefined = require('./isUndefined.cjs.js');
7
7
  require('./isPlainObject.cjs.js');
8
8
  require('./getType.cjs.js');
9
9
 
10
- let mergeObjects=(r,...i)=>{if(!i.length)return r;let m=i.shift();return void 0===m?r:(isObject.isObject(r)&&isObject.isObject(m)&&Object.keys(m).forEach(i=>{isObject.isObject(m[i])?(r[i]||(r[i]={}),mergeObjects(r[i],m[i])):isUndefined.isUndefined(m[i])||(r[i]=m[i]);}),mergeObjects(r,...i))};
10
+ /**
11
+ * Merge two or more objects together. It mutates the target object.
12
+ *
13
+ * @category object
14
+ * @see https://stackoverflow.com/a/46973278/1938970
15
+ */let mergeObjects=(r,...i)=>{if(!i.length)return r;let m=i.shift();return void 0===m?r:(isObject.isObject(r)&&isObject.isObject(m)&&Object.keys(m).forEach(i=>{isObject.isObject(m[i])?(r[i]||(r[i]={}),mergeObjects(r[i],m[i])):isUndefined.isUndefined(m[i])||// FIXME: assertion here should not be needed but isUndefined does not
16
+ // narrow the type here
17
+ (r[i]=m[i]);}),mergeObjects(r,...i))};
11
18
 
12
19
  exports["default"] = mergeObjects;
13
20
  exports.mergeObjects = mergeObjects;
@@ -3,6 +3,13 @@ import { isUndefined } from './isUndefined.esm.js';
3
3
  import './isPlainObject.esm.js';
4
4
  import './getType.esm.js';
5
5
 
6
- let mergeObjects=(r,...i)=>{if(!i.length)return r;let m=i.shift();return void 0===m?r:(isObject(r)&&isObject(m)&&Object.keys(m).forEach(i=>{isObject(m[i])?(r[i]||(r[i]={}),mergeObjects(r[i],m[i])):isUndefined(m[i])||(r[i]=m[i]);}),mergeObjects(r,...i))};
6
+ /**
7
+ * Merge two or more objects together. It mutates the target object.
8
+ *
9
+ * @category object
10
+ * @see https://stackoverflow.com/a/46973278/1938970
11
+ */let mergeObjects=(r,...i)=>{if(!i.length)return r;let m=i.shift();return void 0===m?r:(isObject(r)&&isObject(m)&&Object.keys(m).forEach(i=>{isObject(m[i])?(r[i]||(r[i]={}),mergeObjects(r[i],m[i])):isUndefined(m[i])||// FIXME: assertion here should not be needed but isUndefined does not
12
+ // narrow the type here
13
+ (r[i]=m[i]);}),mergeObjects(r,...i))};
7
14
 
8
15
  export { mergeObjects as default, mergeObjects };
@@ -5,7 +5,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var isNull = require('./isNull.cjs.js');
6
6
  require('./getType.cjs.js');
7
7
 
8
- let mergeUrlQueryParams=(r={},l={})=>{for(let t in l){let m=l[t];r[t]&&isNull.isNull(m)?delete r[t]:r[t]=m;}return r};
8
+ /**
9
+ * Merge query parameters objects, it *mutates* the first given object argument
10
+ *
11
+ * @category location
12
+ */let mergeUrlQueryParams=(r={},l={})=>{for(let t in l){let m=l[t];r[t]&&isNull.isNull(m)?delete r[t]:r[t]=m;}return r};
9
13
 
10
14
  exports["default"] = mergeUrlQueryParams;
11
15
  exports.mergeUrlQueryParams = mergeUrlQueryParams;
@@ -1,6 +1,10 @@
1
1
  import { isNull } from './isNull.esm.js';
2
2
  import './getType.esm.js';
3
3
 
4
- let mergeUrlQueryParams=(r={},l={})=>{for(let t in l){let m=l[t];r[t]&&isNull(m)?delete r[t]:r[t]=m;}return r};
4
+ /**
5
+ * Merge query parameters objects, it *mutates* the first given object argument
6
+ *
7
+ * @category location
8
+ */let mergeUrlQueryParams=(r={},l={})=>{for(let t in l){let m=l[t];r[t]&&isNull(m)?delete r[t]:r[t]=m;}return r};
5
9
 
6
10
  export { mergeUrlQueryParams as default, mergeUrlQueryParams };
@@ -2,7 +2,13 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- let moveSortableArrayItemByKey=(e,r,t,l)=>{let a=e.map(e=>e[r]),o=a.indexOf(t[r]),y=a.indexOf(l[r]),[m]=e.splice(o,1);return e.splice(y,0,m),[...e]};
5
+ /**
6
+ * Move item from one place to another in a sortable array of objects, re-ordering
7
+ * the array accrodingly (no swapping of position).
8
+ * This is useful for drag and drop functionalities
9
+ *
10
+ * @category array
11
+ */let moveSortableArrayItemByKey=(e,r,t,l)=>{let a=e.map(e=>e[r]),o=a.indexOf(t[r]),y=a.indexOf(l[r]),[m]=e.splice(o,1);return e.splice(y,0,m),[...e]};
6
12
 
7
13
  exports["default"] = moveSortableArrayItemByKey;
8
14
  exports.moveSortableArrayItemByKey = moveSortableArrayItemByKey;
@@ -1,3 +1,9 @@
1
- let moveSortableArrayItemByKey=(e,r,t,l)=>{let a=e.map(e=>e[r]),o=a.indexOf(t[r]),y=a.indexOf(l[r]),[m]=e.splice(o,1);return e.splice(y,0,m),[...e]};
1
+ /**
2
+ * Move item from one place to another in a sortable array of objects, re-ordering
3
+ * the array accrodingly (no swapping of position).
4
+ * This is useful for drag and drop functionalities
5
+ *
6
+ * @category array
7
+ */let moveSortableArrayItemByKey=(e,r,t,l)=>{let a=e.map(e=>e[r]),o=a.indexOf(t[r]),y=a.indexOf(l[r]),[m]=e.splice(o,1);return e.splice(y,0,m),[...e]};
2
8
 
3
9
  export { moveSortableArrayItemByKey as default, moveSortableArrayItemByKey };
package/noop.cjs.js CHANGED
@@ -2,7 +2,11 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- let noop=()=>void 0;
5
+ /**
6
+ * No operation function
7
+ *
8
+ * @category native
9
+ */let noop=()=>void 0;
6
10
 
7
11
  exports["default"] = noop;
8
12
  exports.noop = noop;
package/noop.esm.js CHANGED
@@ -1,3 +1,7 @@
1
- let noop=()=>void 0;
1
+ /**
2
+ * No operation function
3
+ *
4
+ * @category native
5
+ */let noop=()=>void 0;
2
6
 
3
7
  export { noop as default, noop };
@@ -4,7 +4,15 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var removeTrailingSlash = require('./removeTrailingSlash.cjs.js');
6
6
 
7
- let normaliseUrl=(e="")=>removeTrailingSlash.removeTrailingSlash(e.replace(/(:\/\/)|(\/)+/g,"$1$2"));
7
+ /**
8
+ * Normalise URL, it works both for absolute and relative URLs
9
+ *
10
+ * - replaces too many consecutive slashes (except `http{s}://`)
11
+ * - removes the trailing slash
12
+ *
13
+ * @category location
14
+ * @see https://stackoverflow.com/a/40649435/1938970
15
+ */let normaliseUrl=(e="")=>removeTrailingSlash.removeTrailingSlash(e.replace(/(:\/\/)|(\/)+/g,"$1$2"));
8
16
 
9
17
  exports["default"] = normaliseUrl;
10
18
  exports.normaliseUrl = normaliseUrl;