@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
@@ -2,7 +2,13 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- let getUrlHashPathname=(a="")=>(a||location.hash).split("?")[0].replace(/^#\//,"");
5
+ /**
6
+ * It returns the "pathname" cleaned up from the `#` and the initial slashes
7
+ * extracting it from the given `hash` string or, if not provided, failling
8
+ * back reading the `location.hash`
9
+ *
10
+ * @category location
11
+ */let getUrlHashPathname=(a="")=>(a||location.hash).split("?")[0].replace(/^#\//,"");
6
12
 
7
13
  exports["default"] = getUrlHashPathname;
8
14
  exports.getUrlHashPathname = getUrlHashPathname;
@@ -1,3 +1,9 @@
1
- let getUrlHashPathname=(a="")=>(a||location.hash).split("?")[0].replace(/^#\//,"");
1
+ /**
2
+ * It returns the "pathname" cleaned up from the `#` and the initial slashes
3
+ * extracting it from the given `hash` string or, if not provided, failling
4
+ * back reading the `location.hash`
5
+ *
6
+ * @category location
7
+ */let getUrlHashPathname=(a="")=>(a||location.hash).split("?")[0].replace(/^#\//,"");
2
8
 
3
9
  export { getUrlHashPathname as default, getUrlHashPathname };
@@ -4,7 +4,16 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var isBrowser = require('./isBrowser.cjs.js');
6
6
 
7
- let getUrlPathnameParts=(e="")=>(e||(isBrowser.isBrowser?location.pathname:"")).replace(/^\//,"").split("/").filter(Boolean);
7
+ /**
8
+ * Get pathname parts
9
+ *
10
+ * First clean the pathname from the first slash if any then split the pathname
11
+ * in parts,
12
+ * Given a pathname like: `"/en/{prefix}/{collection}/{slug}"` we obtain
13
+ * `[locale, prefix, collection, slug]`
14
+ *
15
+ * @category location
16
+ */let getUrlPathnameParts=(e="")=>(e||(isBrowser.isBrowser?location.pathname:"")).replace(/^\//,"").split("/").filter(Boolean);
8
17
 
9
18
  exports["default"] = getUrlPathnameParts;
10
19
  exports.getUrlPathnameParts = getUrlPathnameParts;
@@ -1,5 +1,14 @@
1
1
  import { isBrowser } from './isBrowser.esm.js';
2
2
 
3
- let getUrlPathnameParts=(e="")=>(e||(isBrowser?location.pathname:"")).replace(/^\//,"").split("/").filter(Boolean);
3
+ /**
4
+ * Get pathname parts
5
+ *
6
+ * First clean the pathname from the first slash if any then split the pathname
7
+ * in parts,
8
+ * Given a pathname like: `"/en/{prefix}/{collection}/{slug}"` we obtain
9
+ * `[locale, prefix, collection, slug]`
10
+ *
11
+ * @category location
12
+ */let getUrlPathnameParts=(e="")=>(e||(isBrowser?location.pathname:"")).replace(/^\//,"").split("/").filter(Boolean);
4
13
 
5
14
  export { getUrlPathnameParts as default, getUrlPathnameParts };
@@ -4,7 +4,18 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var isBrowser = require('./isBrowser.cjs.js');
6
6
 
7
- let getUrlQueryParams=r=>{let t={},a=r?r.split("?")?.[1]:isBrowser.isBrowser?location.search.substring(1):"";if(!a)return {};try{let e=`{"${a.replace(/&/g,'","').replace(/=/g,'":"')}"}`;t=JSON.parse(e,(e,r)=>""===e?r:decodeURIComponent(r));}catch(e){}return t};
7
+ /**
8
+ * Get parsed query parameters as object dictionary (from URL or given query string)
9
+ *
10
+ * @category location
11
+ * @param url A URL which contains a `?`, e.g. `?myparam=x` or `https://a.com?myparams=x`.
12
+ * If not provided it defaults reading the current URL query string with
13
+ * `location.search`. Through this argument you can use this same function to
14
+ * parse, for instance, the query params of the `href` of a `<a href="...">` HTML tag.
15
+ *
16
+ */let getUrlQueryParams=r=>{let t={},a=r?r.split("?")?.[1]:isBrowser.isBrowser?location.search.substring(1):"";if(!a)return {};try{// @see https://stackoverflow.com/a/8649003/1938970
17
+ let e=`{"${a.replace(/&/g,'","').replace(/=/g,'":"')}"}`;t=JSON.parse(e,(e,r)=>""===e?r:decodeURIComponent(r));}catch(e){}// do nothing or warn on process.env["NODE_ENV"] === "development"
18
+ return t};
8
19
 
9
20
  exports["default"] = getUrlQueryParams;
10
21
  exports.getUrlQueryParams = getUrlQueryParams;
@@ -1,5 +1,16 @@
1
1
  import { isBrowser } from './isBrowser.esm.js';
2
2
 
3
- let getUrlQueryParams=r=>{let t={},a=r?r.split("?")?.[1]:isBrowser?location.search.substring(1):"";if(!a)return {};try{let e=`{"${a.replace(/&/g,'","').replace(/=/g,'":"')}"}`;t=JSON.parse(e,(e,r)=>""===e?r:decodeURIComponent(r));}catch(e){}return t};
3
+ /**
4
+ * Get parsed query parameters as object dictionary (from URL or given query string)
5
+ *
6
+ * @category location
7
+ * @param url A URL which contains a `?`, e.g. `?myparam=x` or `https://a.com?myparams=x`.
8
+ * If not provided it defaults reading the current URL query string with
9
+ * `location.search`. Through this argument you can use this same function to
10
+ * parse, for instance, the query params of the `href` of a `<a href="...">` HTML tag.
11
+ *
12
+ */let getUrlQueryParams=r=>{let t={},a=r?r.split("?")?.[1]:isBrowser?location.search.substring(1):"";if(!a)return {};try{// @see https://stackoverflow.com/a/8649003/1938970
13
+ let e=`{"${a.replace(/&/g,'","').replace(/=/g,'":"')}"}`;t=JSON.parse(e,(e,r)=>""===e?r:decodeURIComponent(r));}catch(e){}// do nothing or warn on process.env["NODE_ENV"] === "development"
14
+ return t};
4
15
 
5
16
  export { getUrlQueryParams as default, getUrlQueryParams };
package/hashAny.cjs.js CHANGED
@@ -5,7 +5,36 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var isUndefined = require('./isUndefined.cjs.js');
6
6
  require('./getType.cjs.js');
7
7
 
8
- let e=Object,r=new WeakMap,s=0;const hashAny=n=>{let o,f;let i=typeof n,a=n&&n.constructor,h=a==Date;if(e(n)!==n||h||a==RegExp)o=h?n.toJSON():"symbol"==i?n.toString():"string"==i?JSON.stringify(n):""+n;else {if(o=r.get(n))return o;if(o=++s+"~",r.set(n,o),a==Array){for(f=0,o="@";f<n.length;f++)o+=hashAny(n[f])+",";r.set(n,o);}if(a==e){o="#";let s=e.keys(n).sort();for(;!isUndefined.isUndefined(f=s.pop());)isUndefined.isUndefined(n[f])||(o+=f+":"+hashAny(n[f])+",");r.set(n,o);}}return o};
8
+ /* eslint-disable @typescript-eslint/no-explicit-any */// import { OBJECT, isUndefined } from './shared'
9
+ let e=Object,// use WeakMap to store the object->key mapping
10
+ // so the objects can be garbage collected.
11
+ // WeakMap uses a hashtable under the hood, so the lookup
12
+ // complexity is almost O(1).
13
+ r=new WeakMap,// counter of the key
14
+ s=0;/**
15
+ * A stable hash implementation that supports:
16
+ * - Fast and ensures unique hash properties
17
+ * - Handles unserializable values
18
+ * - Handles object key ordering
19
+ * - Generates short results
20
+ *
21
+ * This is not a serialization function, and the result is not guaranteed to be
22
+ * parsable.
23
+ *
24
+ * @borrows [`swr`'s `stableHash`](https://github.com/vercel/swr/blob/main/src/_internal/utils/shared.ts)
25
+ *
26
+ * That is not exported by the package, the following is not possible:
27
+ * ```js
28
+ * import { stableHash } from "swr/_internal/dist";
29
+ * ```
30
+ */const hashAny=n=>{let o,f;let i=typeof n,a=n&&n.constructor,h=a==Date;if(e(n)!==n||h||a==RegExp)o=h?n.toJSON():"symbol"==i?n.toString():"string"==i?JSON.stringify(n):""+n;else {if(// Object/function, not null/date/regexp. Use WeakMap to store the id first.
31
+ // If it's already hashed, directly return the result.
32
+ o=r.get(n))return o;if(// Store the hash first for circular reference detection before entering the
33
+ // recursive `hashAny` calls.
34
+ // For other objects like set and map, we use this id directly as the hash.
35
+ o=++s+"~",r.set(n,o),a==Array){for(f=0,// Array.
36
+ o="@";f<n.length;f++)o+=hashAny(n[f])+",";r.set(n,o);}if(a==e){// Object, sort keys.
37
+ o="#";let s=e.keys(n).sort();for(;!isUndefined.isUndefined(f=s.pop());)isUndefined.isUndefined(n[f])||(o+=f+":"+hashAny(n[f])+",");r.set(n,o);}}return o};
9
38
 
10
39
  exports["default"] = hashAny;
11
40
  exports.hashAny = hashAny;
package/hashAny.esm.js CHANGED
@@ -1,6 +1,35 @@
1
1
  import { isUndefined } from './isUndefined.esm.js';
2
2
  import './getType.esm.js';
3
3
 
4
- let e=Object,r=new WeakMap,s=0;const hashAny=n=>{let o,f;let i=typeof n,a=n&&n.constructor,h=a==Date;if(e(n)!==n||h||a==RegExp)o=h?n.toJSON():"symbol"==i?n.toString():"string"==i?JSON.stringify(n):""+n;else {if(o=r.get(n))return o;if(o=++s+"~",r.set(n,o),a==Array){for(f=0,o="@";f<n.length;f++)o+=hashAny(n[f])+",";r.set(n,o);}if(a==e){o="#";let s=e.keys(n).sort();for(;!isUndefined(f=s.pop());)isUndefined(n[f])||(o+=f+":"+hashAny(n[f])+",");r.set(n,o);}}return o};
4
+ /* eslint-disable @typescript-eslint/no-explicit-any */// import { OBJECT, isUndefined } from './shared'
5
+ let e=Object,// use WeakMap to store the object->key mapping
6
+ // so the objects can be garbage collected.
7
+ // WeakMap uses a hashtable under the hood, so the lookup
8
+ // complexity is almost O(1).
9
+ r=new WeakMap,// counter of the key
10
+ s=0;/**
11
+ * A stable hash implementation that supports:
12
+ * - Fast and ensures unique hash properties
13
+ * - Handles unserializable values
14
+ * - Handles object key ordering
15
+ * - Generates short results
16
+ *
17
+ * This is not a serialization function, and the result is not guaranteed to be
18
+ * parsable.
19
+ *
20
+ * @borrows [`swr`'s `stableHash`](https://github.com/vercel/swr/blob/main/src/_internal/utils/shared.ts)
21
+ *
22
+ * That is not exported by the package, the following is not possible:
23
+ * ```js
24
+ * import { stableHash } from "swr/_internal/dist";
25
+ * ```
26
+ */const hashAny=n=>{let o,f;let i=typeof n,a=n&&n.constructor,h=a==Date;if(e(n)!==n||h||a==RegExp)o=h?n.toJSON():"symbol"==i?n.toString():"string"==i?JSON.stringify(n):""+n;else {if(// Object/function, not null/date/regexp. Use WeakMap to store the id first.
27
+ // If it's already hashed, directly return the result.
28
+ o=r.get(n))return o;if(// Store the hash first for circular reference detection before entering the
29
+ // recursive `hashAny` calls.
30
+ // For other objects like set and map, we use this id directly as the hash.
31
+ o=++s+"~",r.set(n,o),a==Array){for(f=0,// Array.
32
+ o="@";f<n.length;f++)o+=hashAny(n[f])+",";r.set(n,o);}if(a==e){// Object, sort keys.
33
+ o="#";let s=e.keys(n).sort();for(;!isUndefined(f=s.pop());)isUndefined(n[f])||(o+=f+":"+hashAny(n[f])+",");r.set(n,o);}}return o};
5
34
 
6
35
  export { hashAny as default, hashAny };
@@ -2,7 +2,11 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- let imgEmptyPixel="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=";
5
+ /**
6
+ * Empty img pixel as a string to inline
7
+ *
8
+ * @category img
9
+ */let imgEmptyPixel="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=";
6
10
 
7
11
  exports["default"] = imgEmptyPixel;
8
12
  exports.imgEmptyPixel = imgEmptyPixel;
@@ -1,3 +1,7 @@
1
- let imgEmptyPixel="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=";
1
+ /**
2
+ * Empty img pixel as a string to inline
3
+ *
4
+ * @category img
5
+ */let imgEmptyPixel="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=";
2
6
 
3
7
  export { imgEmptyPixel as default, imgEmptyPixel };
package/invariant.cjs.js CHANGED
@@ -2,7 +2,23 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- let invariant=(e,t,r,n)=>{if("development"===process.env.NODE_ENV){if(e)return;let o="function"==typeof t?t():t,i="";throw r&&n?i=`[${r}:${n}] `:r&&(i=`[${r}] `),Error(i+o)}};
5
+ /**
6
+ * FIXME: invariant calls do not get tree shaked in minified output of projects
7
+ * using it. Let's not use it internally and not export it from `@koine/utils`
8
+ * until we find a tree-shakeable way of doing this. For now just wrapping
9
+ * the logging code into `if (process.env["NODE_ENV"] === "development") {}`
10
+ * works better despite it is more verbose.
11
+ *
12
+ * @resources
13
+ * - https://github.com/alexreardon/tiny-invariant
14
+ * - https://github.com/zertosh/invariant
15
+ * - https://stackoverflow.com/q/39055159/1938970
16
+ *
17
+ * @param condition The condition that, if `true` will throw the error during development
18
+ * @param message A string or a function that returns a string
19
+ * @param lib The library name to show in the error message prefix. When `lib` is also specified it outputs `[lib:prefix]: the message`, otherwise just `[lib|prefix]: the message`)
20
+ * @param prefix The library name to show in the error message prefix. When `lib` is also specified it outputs `[lib:prefix]: the message`, otherwise just `[lib|prefix]: the message`)
21
+ */let invariant=(e,t,r,n)=>{if("development"===process.env.NODE_ENV){if(e)return;let o="function"==typeof t?t():t,i="";throw r&&n?i=`[${r}:${n}] `:r&&(i=`[${r}] `),Error(i+o)}};
6
22
 
7
23
  exports["default"] = invariant;
8
24
  exports.invariant = invariant;
package/invariant.esm.js CHANGED
@@ -1,3 +1,19 @@
1
- let invariant=(e,t,r,n)=>{if("development"===process.env.NODE_ENV){if(e)return;let o="function"==typeof t?t():t,i="";throw r&&n?i=`[${r}:${n}] `:r&&(i=`[${r}] `),Error(i+o)}};
1
+ /**
2
+ * FIXME: invariant calls do not get tree shaked in minified output of projects
3
+ * using it. Let's not use it internally and not export it from `@koine/utils`
4
+ * until we find a tree-shakeable way of doing this. For now just wrapping
5
+ * the logging code into `if (process.env["NODE_ENV"] === "development") {}`
6
+ * works better despite it is more verbose.
7
+ *
8
+ * @resources
9
+ * - https://github.com/alexreardon/tiny-invariant
10
+ * - https://github.com/zertosh/invariant
11
+ * - https://stackoverflow.com/q/39055159/1938970
12
+ *
13
+ * @param condition The condition that, if `true` will throw the error during development
14
+ * @param message A string or a function that returns a string
15
+ * @param lib The library name to show in the error message prefix. When `lib` is also specified it outputs `[lib:prefix]: the message`, otherwise just `[lib|prefix]: the message`)
16
+ * @param prefix The library name to show in the error message prefix. When `lib` is also specified it outputs `[lib:prefix]: the message`, otherwise just `[lib|prefix]: the message`)
17
+ */let invariant=(e,t,r,n)=>{if("development"===process.env.NODE_ENV){if(e)return;let o="function"==typeof t?t():t,i="";throw r&&n?i=`[${r}:${n}] `:r&&(i=`[${r}] `),Error(i+o)}};
2
18
 
3
19
  export { invariant as default, invariant };
@@ -2,7 +2,11 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- let t=/^(?:[a-z+]+:)?\/\//i;let isAbsoluteUrl=e=>t.test(e);
5
+ let t=/^(?:[a-z+]+:)?\/\//i;/**
6
+ * @borrows [SO's answer](https://stackoverflow.com/a/19709846/1938970)
7
+ *
8
+ * @category is
9
+ */let isAbsoluteUrl=e=>t.test(e);
6
10
 
7
11
  exports["default"] = isAbsoluteUrl;
8
12
  exports.isAbsoluteUrl = isAbsoluteUrl;
@@ -1,3 +1,7 @@
1
- let t=/^(?:[a-z+]+:)?\/\//i;let isAbsoluteUrl=e=>t.test(e);
1
+ let t=/^(?:[a-z+]+:)?\/\//i;/**
2
+ * @borrows [SO's answer](https://stackoverflow.com/a/19709846/1938970)
3
+ *
4
+ * @category is
5
+ */let isAbsoluteUrl=e=>t.test(e);
2
6
 
3
7
  export { isAbsoluteUrl as default, isAbsoluteUrl };
@@ -4,7 +4,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var getType = require('./getType.cjs.js');
6
6
 
7
- let isAnyObject=t=>"Object"===getType.getType(t);
7
+ /**
8
+ * Returns whether the payload is an any kind of object (including special classes or objects with different prototypes)
9
+ *
10
+ * @category is
11
+ */let isAnyObject=t=>"Object"===getType.getType(t);
8
12
 
9
13
  exports["default"] = isAnyObject;
10
14
  exports.isAnyObject = isAnyObject;
@@ -1,5 +1,9 @@
1
1
  import { getType } from './getType.esm.js';
2
2
 
3
- let isAnyObject=t=>"Object"===getType(t);
3
+ /**
4
+ * Returns whether the payload is an any kind of object (including special classes or objects with different prototypes)
5
+ *
6
+ * @category is
7
+ */let isAnyObject=t=>"Object"===getType(t);
4
8
 
5
9
  export { isAnyObject as default, isAnyObject };
package/isArray.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 isArray=e=>"Array"===getType.getType(e);
7
+ /**
8
+ * Returns whether the payload is an array
9
+ *
10
+ * @category is
11
+ */let isArray=e=>"Array"===getType.getType(e);
8
12
 
9
13
  exports["default"] = isArray;
10
14
  exports.isArray = isArray;
package/isArray.esm.js CHANGED
@@ -1,5 +1,9 @@
1
1
  import { getType } from './getType.esm.js';
2
2
 
3
- let isArray=e=>"Array"===getType(e);
3
+ /**
4
+ * Returns whether the payload is an array
5
+ *
6
+ * @category is
7
+ */let isArray=e=>"Array"===getType(e);
4
8
 
5
9
  export { isArray as default, isArray };
package/isBlob.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 isBlob=e=>"Blob"===getType.getType(e);
7
+ /**
8
+ * Returns whether the payload is a Blob
9
+ *
10
+ * @category is
11
+ */let isBlob=e=>"Blob"===getType.getType(e);
8
12
 
9
13
  exports["default"] = isBlob;
10
14
  exports.isBlob = isBlob;
package/isBlob.esm.js CHANGED
@@ -1,5 +1,9 @@
1
1
  import { getType } from './getType.esm.js';
2
2
 
3
- let isBlob=e=>"Blob"===getType(e);
3
+ /**
4
+ * Returns whether the payload is a Blob
5
+ *
6
+ * @category is
7
+ */let isBlob=e=>"Blob"===getType(e);
4
8
 
5
9
  export { isBlob as default, isBlob };
package/isBoolean.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 isBoolean=e=>"Boolean"===getType.getType(e);
7
+ /**
8
+ * Returns whether the payload is a boolean
9
+ *
10
+ * @category is
11
+ */let isBoolean=e=>"Boolean"===getType.getType(e);
8
12
 
9
13
  exports["default"] = isBoolean;
10
14
  exports.isBoolean = isBoolean;
package/isBoolean.esm.js CHANGED
@@ -1,5 +1,9 @@
1
1
  import { getType } from './getType.esm.js';
2
2
 
3
- let isBoolean=e=>"Boolean"===getType(e);
3
+ /**
4
+ * Returns whether the payload is a boolean
5
+ *
6
+ * @category is
7
+ */let isBoolean=e=>"Boolean"===getType(e);
4
8
 
5
9
  export { isBoolean as default, isBoolean };
package/isBrowser.cjs.js CHANGED
@@ -2,7 +2,10 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- let isBrowser="undefined"!=typeof window;
5
+ /**
6
+ * @category ssr
7
+ * @category is
8
+ */let isBrowser="undefined"!=typeof window;
6
9
 
7
10
  exports["default"] = isBrowser;
8
11
  exports.isBrowser = isBrowser;
package/isBrowser.esm.js CHANGED
@@ -1,3 +1,6 @@
1
- let isBrowser="undefined"!=typeof window;
1
+ /**
2
+ * @category ssr
3
+ * @category is
4
+ */let isBrowser="undefined"!=typeof window;
2
5
 
3
6
  export { isBrowser as default, isBrowser };
@@ -5,7 +5,10 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var isUndefined = require('./isUndefined.cjs.js');
6
6
  require('./getType.cjs.js');
7
7
 
8
- let isBrowserNow=()=>!isUndefined.isUndefined(window);
8
+ /**
9
+ * @category ssr
10
+ * @category is
11
+ */let isBrowserNow=()=>!isUndefined.isUndefined(window);
9
12
 
10
13
  exports["default"] = isBrowserNow;
11
14
  exports.isBrowserNow = isBrowserNow;
@@ -1,6 +1,9 @@
1
1
  import { isUndefined } from './isUndefined.esm.js';
2
2
  import './getType.esm.js';
3
3
 
4
- let isBrowserNow=()=>!isUndefined(window);
4
+ /**
5
+ * @category ssr
6
+ * @category is
7
+ */let isBrowserNow=()=>!isUndefined(window);
5
8
 
6
9
  export { isBrowserNow as default, isBrowserNow };
package/isDate.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 isDate=t=>"Date"===getType.getType(t)&&!isNaN(t);
7
+ /**
8
+ * Returns whether the payload is a Date, and that the date is valid
9
+ *
10
+ * @category is
11
+ */let isDate=t=>"Date"===getType.getType(t)&&!isNaN(t);
8
12
 
9
13
  exports["default"] = isDate;
10
14
  exports.isDate = isDate;
package/isDate.esm.js CHANGED
@@ -1,5 +1,9 @@
1
1
  import { getType } from './getType.esm.js';
2
2
 
3
- let isDate=t=>"Date"===getType(t)&&!isNaN(t);
3
+ /**
4
+ * Returns whether the payload is a Date, and that the date is valid
5
+ *
6
+ * @category is
7
+ */let isDate=t=>"Date"===getType(t)&&!isNaN(t);
4
8
 
5
9
  export { isDate as default, isDate };
@@ -5,7 +5,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var isArray = require('./isArray.cjs.js');
6
6
  require('./getType.cjs.js');
7
7
 
8
- let isEmptyArray=t=>isArray.isArray(t)&&0===t.length;
8
+ /**
9
+ * Returns whether the payload is a an empty array
10
+ *
11
+ * @category is
12
+ */let isEmptyArray=t=>isArray.isArray(t)&&0===t.length;
9
13
 
10
14
  exports["default"] = isEmptyArray;
11
15
  exports.isEmptyArray = isEmptyArray;
@@ -1,6 +1,10 @@
1
1
  import { isArray } from './isArray.esm.js';
2
2
  import './getType.esm.js';
3
3
 
4
- let isEmptyArray=t=>isArray(t)&&0===t.length;
4
+ /**
5
+ * Returns whether the payload is a an empty array
6
+ *
7
+ * @category is
8
+ */let isEmptyArray=t=>isArray(t)&&0===t.length;
5
9
 
6
10
  export { isEmptyArray as default, isEmptyArray };
@@ -5,7 +5,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var isPlainObject = require('./isPlainObject.cjs.js');
6
6
  require('./getType.cjs.js');
7
7
 
8
- let isEmptyObject=e=>isPlainObject.isPlainObject(e)&&0===Object.keys(e).length;
8
+ /**
9
+ * Returns whether the payload is a an empty object (excluding special classes or objects with other prototypes)
10
+ *
11
+ * @category is
12
+ */let isEmptyObject=e=>isPlainObject.isPlainObject(e)&&0===Object.keys(e).length;
9
13
 
10
14
  exports["default"] = isEmptyObject;
11
15
  exports.isEmptyObject = isEmptyObject;
@@ -1,6 +1,10 @@
1
1
  import { isPlainObject } from './isPlainObject.esm.js';
2
2
  import './getType.esm.js';
3
3
 
4
- let isEmptyObject=e=>isPlainObject(e)&&0===Object.keys(e).length;
4
+ /**
5
+ * Returns whether the payload is a an empty object (excluding special classes or objects with other prototypes)
6
+ *
7
+ * @category is
8
+ */let isEmptyObject=e=>isPlainObject(e)&&0===Object.keys(e).length;
5
9
 
6
10
  export { isEmptyObject as default, isEmptyObject };
@@ -2,7 +2,11 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- let isEmptyString=t=>""===t;
5
+ /**
6
+ * Returns whether the payload is ''
7
+ *
8
+ * @category is
9
+ */let isEmptyString=t=>""===t;
6
10
 
7
11
  exports["default"] = isEmptyString;
8
12
  exports.isEmptyString = isEmptyString;
@@ -1,3 +1,7 @@
1
- let isEmptyString=t=>""===t;
1
+ /**
2
+ * Returns whether the payload is ''
3
+ *
4
+ * @category is
5
+ */let isEmptyString=t=>""===t;
2
6
 
3
7
  export { isEmptyString as default, isEmptyString };
package/isError.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 isError=o=>"Error"===getType.getType(o);
7
+ /**
8
+ * Returns whether the payload is an Error
9
+ *
10
+ * @category is
11
+ */let isError=o=>"Error"===getType.getType(o);
8
12
 
9
13
  exports["default"] = isError;
10
14
  exports.isError = isError;
package/isError.esm.js CHANGED
@@ -1,5 +1,9 @@
1
1
  import { getType } from './getType.esm.js';
2
2
 
3
- let isError=o=>"Error"===getType(o);
3
+ /**
4
+ * Returns whether the payload is an Error
5
+ *
6
+ * @category is
7
+ */let isError=o=>"Error"===getType(o);
4
8
 
5
9
  export { isError as default, isError };
@@ -4,7 +4,15 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var isBrowser = require('./isBrowser.cjs.js');
6
6
 
7
- let isExternalUrl=(r,t)=>{let l=/https?:\/\/((?:[\w\d-]+\.)+[\w\d]{2,})/i,o=l.exec(r);return !!o&&(!(t=t||isBrowser.isBrowser?location.href:"")||l.exec(t)?.[1]!==o[1])};
7
+ /**
8
+ * Is external url compared to the given current URL (if not provided it falls
9
+ * back to `location.href`)
10
+ *
11
+ * @category location
12
+ *
13
+ */let isExternalUrl=(r,t)=>{let l=/https?:\/\/((?:[\w\d-]+\.)+[\w\d]{2,})/i,o=l.exec(r);return(// if no matches are found it means we either have an invalid URL, a relative
14
+ // URL or a hash link, and those are not considered externals
15
+ !!o&&(!(t=t||isBrowser.isBrowser?location.href:"")||l.exec(t)?.[1]!==o[1]))};
8
16
 
9
17
  exports["default"] = isExternalUrl;
10
18
  exports.isExternalUrl = isExternalUrl;
@@ -1,5 +1,13 @@
1
1
  import { isBrowser } from './isBrowser.esm.js';
2
2
 
3
- let isExternalUrl=(r,t)=>{let l=/https?:\/\/((?:[\w\d-]+\.)+[\w\d]{2,})/i,o=l.exec(r);return !!o&&(!(t=t||isBrowser?location.href:"")||l.exec(t)?.[1]!==o[1])};
3
+ /**
4
+ * Is external url compared to the given current URL (if not provided it falls
5
+ * back to `location.href`)
6
+ *
7
+ * @category location
8
+ *
9
+ */let isExternalUrl=(r,t)=>{let l=/https?:\/\/((?:[\w\d-]+\.)+[\w\d]{2,})/i,o=l.exec(r);return(// if no matches are found it means we either have an invalid URL, a relative
10
+ // URL or a hash link, and those are not considered externals
11
+ !!o&&(!(t=t||isBrowser?location.href:"")||l.exec(t)?.[1]!==o[1]))};
4
12
 
5
13
  export { isExternalUrl as default, isExternalUrl };
package/isFile.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 isFile=i=>"File"===getType.getType(i);
7
+ /**
8
+ * Returns whether the payload is a File
9
+ *
10
+ * @category is
11
+ */let isFile=i=>"File"===getType.getType(i);
8
12
 
9
13
  exports["default"] = isFile;
10
14
  exports.isFile = isFile;
package/isFile.esm.js CHANGED
@@ -1,5 +1,9 @@
1
1
  import { getType } from './getType.esm.js';
2
2
 
3
- let isFile=i=>"File"===getType(i);
3
+ /**
4
+ * Returns whether the payload is a File
5
+ *
6
+ * @category is
7
+ */let isFile=i=>"File"===getType(i);
4
8
 
5
9
  export { isFile as default, isFile };
package/isFloat.cjs.js CHANGED
@@ -5,7 +5,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var isNumber = require('./isNumber.cjs.js');
6
6
  require('./getType.cjs.js');
7
7
 
8
- let isFloat=o=>isNumber.isNumber(o)&&o%1!=0;
8
+ /**
9
+ * Returns whether the payload is a float number
10
+ *
11
+ * @category is
12
+ */let isFloat=o=>isNumber.isNumber(o)&&o%1!=0;
9
13
 
10
14
  exports["default"] = isFloat;
11
15
  exports.isFloat = isFloat;