@koine/utils 2.0.0-beta.1 → 2.0.0-beta.10

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 (286) hide show
  1. package/Defer.js +23 -18
  2. package/Defer.mjs +6 -5
  3. package/Emitter.js +31 -20
  4. package/Emitter.mjs +13 -16
  5. package/README.md +6 -1
  6. package/accentSets.js +129 -37
  7. package/accentSets.mjs +113 -29
  8. package/addOrReplaceAtIdx.js +27 -10
  9. package/addOrReplaceAtIdx.mjs +9 -6
  10. package/areEqual.js +35 -41
  11. package/areEqual.mjs +16 -22
  12. package/arrayOfAll.js +20 -11
  13. package/arrayOfAll.mjs +1 -6
  14. package/arraySum.js +20 -9
  15. package/arraySum.mjs +1 -4
  16. package/arrayToLookup.js +21 -9
  17. package/arrayToLookup.mjs +2 -4
  18. package/buildUrlQueryString.js +32 -29
  19. package/buildUrlQueryString.mjs +11 -14
  20. package/capitalize.js +21 -9
  21. package/capitalize.mjs +3 -5
  22. package/changeUrlPath.js +23 -17
  23. package/changeUrlPath.mjs +2 -3
  24. package/chunkByChunks.js +35 -24
  25. package/chunkByChunks.mjs +17 -20
  26. package/chunkBySize.js +21 -8
  27. package/chunkBySize.mjs +3 -4
  28. package/clamp.js +19 -6
  29. package/clamp.mjs +1 -2
  30. package/clsx.d.ts +4 -1
  31. package/clsx.js +30 -23
  32. package/clsx.mjs +12 -14
  33. package/convertRange.js +20 -7
  34. package/convertRange.mjs +2 -3
  35. package/cookie.js +13 -5
  36. package/cookie.mjs +3 -2
  37. package/createPalette.js +32 -19
  38. package/createPalette.mjs +14 -6
  39. package/debounce.js +27 -21
  40. package/debounce.mjs +9 -17
  41. package/debouncePromise.d.ts +14 -4
  42. package/debouncePromise.js +86 -11
  43. package/debouncePromise.mjs +69 -3
  44. package/debounceRaf.js +23 -14
  45. package/debounceRaf.mjs +5 -10
  46. package/decode.js +20 -7
  47. package/decode.mjs +2 -3
  48. package/encode.js +20 -7
  49. package/encode.mjs +2 -3
  50. package/ensureInt.js +20 -9
  51. package/ensureInt.mjs +1 -4
  52. package/env.js +1 -1
  53. package/env.mjs +0 -1
  54. package/errorToString.js +21 -14
  55. package/errorToString.mjs +1 -4
  56. package/findDuplicatedIndexes.js +22 -9
  57. package/findDuplicatedIndexes.mjs +4 -5
  58. package/forin.js +20 -7
  59. package/forin.mjs +2 -3
  60. package/gbToBytes.js +20 -7
  61. package/gbToBytes.mjs +1 -2
  62. package/getEmptyArray.js +25 -16
  63. package/getEmptyArray.mjs +4 -3
  64. package/getKeys.js +20 -6
  65. package/getKeys.mjs +1 -2
  66. package/getMediaQueryWidthResolvers.js +62 -53
  67. package/getMediaQueryWidthResolvers.mjs +44 -49
  68. package/getMediaQueryWidthTailwindScreens.js +36 -18
  69. package/getMediaQueryWidthTailwindScreens.mjs +18 -14
  70. package/getNonce.js +20 -10
  71. package/getNonce.mjs +1 -2
  72. package/getParamAmong.js +22 -19
  73. package/getParamAmong.mjs +2 -4
  74. package/getParamAsInt.js +22 -19
  75. package/getParamAsInt.mjs +2 -4
  76. package/getParamAsString.js +21 -16
  77. package/getParamAsString.mjs +1 -2
  78. package/getType.js +19 -12
  79. package/getType.mjs +2 -4
  80. package/getUrlHashParams.js +20 -13
  81. package/getUrlHashParams.mjs +2 -4
  82. package/getUrlHashPathname.js +20 -8
  83. package/getUrlHashPathname.mjs +1 -3
  84. package/getUrlPathnameParts.js +23 -23
  85. package/getUrlPathnameParts.mjs +2 -7
  86. package/getUrlQueryParams.js +26 -33
  87. package/getUrlQueryParams.mjs +7 -18
  88. package/imgEmptyPixel.js +20 -6
  89. package/imgEmptyPixel.mjs +1 -2
  90. package/index.d.ts +1 -1
  91. package/index.js +531 -266
  92. package/index.mjs +2 -2
  93. package/invariant.js +24 -12
  94. package/invariant.mjs +6 -8
  95. package/isAnyObject.js +21 -12
  96. package/isAnyObject.mjs +1 -2
  97. package/isArray.js +21 -12
  98. package/isArray.mjs +1 -2
  99. package/isBlob.js +21 -12
  100. package/isBlob.mjs +1 -2
  101. package/isBoolean.js +21 -12
  102. package/isBoolean.mjs +1 -2
  103. package/isBrowser.js +20 -6
  104. package/isBrowser.mjs +1 -2
  105. package/isBrowserNow.js +21 -11
  106. package/isBrowserNow.mjs +1 -2
  107. package/isDate.js +21 -12
  108. package/isDate.mjs +1 -2
  109. package/isEmptyArray.js +21 -12
  110. package/isEmptyArray.mjs +1 -2
  111. package/isEmptyObject.js +21 -12
  112. package/isEmptyObject.mjs +1 -2
  113. package/isEmptyString.js +19 -6
  114. package/isEmptyString.mjs +1 -2
  115. package/isError.js +21 -12
  116. package/isError.mjs +1 -2
  117. package/isExternalUrl.js +24 -18
  118. package/isExternalUrl.mjs +4 -6
  119. package/isFile.js +21 -12
  120. package/isFile.mjs +1 -2
  121. package/isFloat.js +21 -12
  122. package/isFloat.mjs +1 -2
  123. package/isFormData.js +21 -12
  124. package/isFormData.mjs +1 -2
  125. package/isFullArray.js +21 -12
  126. package/isFullArray.mjs +1 -2
  127. package/isFullObject.js +21 -12
  128. package/isFullObject.mjs +1 -2
  129. package/isFullString.js +21 -12
  130. package/isFullString.mjs +1 -2
  131. package/isFunction.js +18 -9
  132. package/isFunction.mjs +1 -2
  133. package/isInt.js +21 -12
  134. package/isInt.mjs +1 -2
  135. package/isMap.js +21 -12
  136. package/isMap.mjs +1 -2
  137. package/isNaNValue.js +21 -12
  138. package/isNaNValue.mjs +1 -2
  139. package/isNegativeNumber.js +21 -12
  140. package/isNegativeNumber.mjs +1 -2
  141. package/isNull.js +21 -12
  142. package/isNull.mjs +1 -2
  143. package/isNullOrUndefined.js +23 -13
  144. package/isNullOrUndefined.mjs +1 -2
  145. package/isNumber.js +21 -14
  146. package/isNumber.mjs +1 -2
  147. package/isObject.js +21 -12
  148. package/isObject.mjs +1 -2
  149. package/isObjectLike.js +21 -14
  150. package/isObjectLike.mjs +1 -2
  151. package/isOneOf.js +19 -11
  152. package/isOneOf.mjs +1 -7
  153. package/isPlainObject.js +22 -15
  154. package/isPlainObject.mjs +3 -6
  155. package/isPositiveNumber.js +21 -12
  156. package/isPositiveNumber.mjs +1 -2
  157. package/isPrimitive.js +26 -22
  158. package/isPrimitive.mjs +5 -11
  159. package/isPromise.js +21 -12
  160. package/isPromise.mjs +1 -2
  161. package/isRegExp.js +21 -12
  162. package/isRegExp.mjs +1 -2
  163. package/isServer.js +22 -11
  164. package/isServer.mjs +1 -2
  165. package/isServerNow.js +21 -11
  166. package/isServerNow.mjs +1 -2
  167. package/isSet.js +21 -12
  168. package/isSet.mjs +1 -2
  169. package/isString.js +21 -12
  170. package/isString.mjs +1 -2
  171. package/isSymbol.js +21 -12
  172. package/isSymbol.mjs +1 -2
  173. package/isType.js +22 -17
  174. package/isType.mjs +3 -5
  175. package/isUndefined.js +21 -12
  176. package/isUndefined.mjs +1 -2
  177. package/isWeakMap.js +21 -12
  178. package/isWeakMap.mjs +1 -2
  179. package/isWeakSet.js +21 -12
  180. package/isWeakSet.mjs +1 -2
  181. package/kbToBytes.js +20 -7
  182. package/kbToBytes.mjs +1 -2
  183. package/location.js +6 -2
  184. package/location.mjs +3 -1
  185. package/lowercase.js +20 -9
  186. package/lowercase.mjs +1 -4
  187. package/mapListBy.js +21 -10
  188. package/mapListBy.mjs +2 -5
  189. package/matchSorter.js +132 -133
  190. package/matchSorter.mjs +108 -126
  191. package/mbToBytes.js +20 -7
  192. package/mbToBytes.mjs +1 -2
  193. package/mergeObjects.d.ts +1 -1
  194. package/mergeObjects.js +24 -26
  195. package/mergeObjects.mjs +12 -15
  196. package/mergeUrlQueryParams.js +25 -20
  197. package/mergeUrlQueryParams.mjs +4 -8
  198. package/moveSortableArrayItemByKey.js +26 -12
  199. package/moveSortableArrayItemByKey.mjs +8 -8
  200. package/noop.js +20 -7
  201. package/noop.mjs +1 -2
  202. package/normaliseUrl.js +22 -18
  203. package/normaliseUrl.mjs +1 -3
  204. package/normaliseUrlPathname.js +22 -17
  205. package/normaliseUrlPathname.mjs +1 -3
  206. package/objectOmit.js +21 -9
  207. package/objectOmit.mjs +3 -5
  208. package/objectPick.js +22 -9
  209. package/objectPick.mjs +4 -5
  210. package/package.json +7 -11
  211. package/parseCookie.js +29 -26
  212. package/parseCookie.mjs +11 -15
  213. package/parseURL.js +23 -10
  214. package/parseURL.mjs +5 -6
  215. package/quaranteneProps.js +24 -12
  216. package/quaranteneProps.mjs +6 -8
  217. package/randomInt.js +19 -6
  218. package/randomInt.mjs +1 -2
  219. package/randomKey.js +21 -8
  220. package/randomKey.mjs +3 -4
  221. package/readCookie.js +25 -12
  222. package/readCookie.mjs +7 -8
  223. package/removeAccents.js +24 -15
  224. package/removeAccents.mjs +5 -8
  225. package/removeCookie.js +26 -17
  226. package/removeCookie.mjs +6 -5
  227. package/removeDuplicates.js +1 -1
  228. package/removeDuplicates.mjs +0 -1
  229. package/removeDuplicatesByKey.js +24 -12
  230. package/removeDuplicatesByKey.mjs +5 -7
  231. package/removeDuplicatesComparing.js +22 -11
  232. package/removeDuplicatesComparing.mjs +3 -4
  233. package/removeIndexesFromArray.js +21 -8
  234. package/removeIndexesFromArray.mjs +3 -4
  235. package/removeTrailingSlash.js +20 -8
  236. package/removeTrailingSlash.mjs +1 -3
  237. package/removeUrlQueryParams.js +27 -20
  238. package/removeUrlQueryParams.mjs +5 -7
  239. package/render.js +61 -137
  240. package/render.mjs +43 -98
  241. package/roundTo.js +34 -22
  242. package/roundTo.mjs +15 -17
  243. package/serializeCookie.js +29 -35
  244. package/serializeCookie.mjs +9 -15
  245. package/setCookie.js +37 -31
  246. package/setCookie.mjs +13 -16
  247. package/shuffle.js +28 -14
  248. package/shuffle.mjs +10 -10
  249. package/slugify.js +33 -25
  250. package/slugify.mjs +13 -11
  251. package/split.js +18 -4
  252. package/swapMap.js +22 -10
  253. package/swapMap.mjs +3 -5
  254. package/throttle.d.ts +1 -0
  255. package/throttle.js +23 -15
  256. package/throttle.mjs +5 -11
  257. package/titleCase.js +20 -11
  258. package/titleCase.mjs +1 -6
  259. package/toNumber.js +20 -9
  260. package/toNumber.mjs +1 -2
  261. package/toRgba.js +22 -10
  262. package/toRgba.mjs +3 -5
  263. package/transformToUrlPathname.js +21 -18
  264. package/transformToUrlPathname.mjs +2 -5
  265. package/truncate.js +20 -13
  266. package/truncate.mjs +1 -8
  267. package/tryUntil.js +26 -15
  268. package/tryUntil.mjs +7 -10
  269. package/types.js +4 -1
  270. package/types.mjs +2 -1
  271. package/uid.js +21 -13
  272. package/uid.mjs +3 -5
  273. package/updateLinkParams.js +21 -14
  274. package/updateLinkParams.mjs +2 -3
  275. package/updateUrlQueryParams.js +26 -21
  276. package/updateUrlQueryParams.mjs +3 -7
  277. package/uppercase.js +20 -9
  278. package/uppercase.mjs +1 -4
  279. package/uuid.js +21 -10
  280. package/uuid.mjs +2 -5
  281. package/uuidNumeric.js +20 -7
  282. package/uuidNumeric.mjs +1 -2
  283. package/wait.js +20 -9
  284. package/wait.mjs +1 -4
  285. package/without.js +2 -3
  286. package/without.mjs +1 -3
package/getType.js CHANGED
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  /**
3
2
  * @file
4
3
  *
@@ -7,17 +6,25 @@
7
6
  * - `isFormData`
8
7
  * - `isInt`
9
8
  * - `isFloat`
10
- */
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.getType = void 0;
13
- /**
14
- * Returns the object type of the given payload
15
- *
16
- * @param {*} payload
17
- * @returns {string}
18
- */
9
+ */ "use strict";
10
+ Object.defineProperty(exports, "__esModule", {
11
+ value: true
12
+ });
13
+ function _export(target, all) {
14
+ for(var name in all)Object.defineProperty(target, name, {
15
+ enumerable: true,
16
+ get: all[name]
17
+ });
18
+ }
19
+ _export(exports, {
20
+ getType: function() {
21
+ return getType;
22
+ },
23
+ default: function() {
24
+ return _default;
25
+ }
26
+ });
19
27
  function getType(payload) {
20
28
  return Object.prototype.toString.call(payload).slice(8, -1);
21
29
  }
22
- exports.getType = getType;
23
- exports.default = getType;
30
+ const _default = getType;
package/getType.mjs CHANGED
@@ -6,14 +6,12 @@
6
6
  * - `isFormData`
7
7
  * - `isInt`
8
8
  * - `isFloat`
9
- */
10
- /**
9
+ */ /**
11
10
  * Returns the object type of the given payload
12
11
  *
13
12
  * @param {*} payload
14
13
  * @returns {string}
15
- */
16
- export function getType(payload) {
14
+ */ export function getType(payload) {
17
15
  return Object.prototype.toString.call(payload).slice(8, -1);
18
16
  }
19
17
  export default getType;
@@ -1,20 +1,27 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getUrlHashParams = void 0;
4
- /**
5
- * It returns the "query params" as an object extracting it from the given `hash`
6
- * string or, if not provided, failling back reading the `location.hash`
7
- *
8
- * @category location
9
- */
10
- function getUrlHashParams(hash) {
11
- if (hash === void 0) { hash = ""; }
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
10
+ }
11
+ _export(exports, {
12
+ getUrlHashParams: function() {
13
+ return getUrlHashParams;
14
+ },
15
+ default: function() {
16
+ return _default;
17
+ }
18
+ });
19
+ function getUrlHashParams(hash = "") {
12
20
  hash = hash || location.hash;
13
- var hashParts = hash.split("?");
21
+ const hashParts = hash.split("?");
14
22
  if (hashParts.length >= 1) {
15
23
  return Object.fromEntries(new URLSearchParams(hashParts[1]));
16
24
  }
17
25
  return {};
18
26
  }
19
- exports.getUrlHashParams = getUrlHashParams;
20
- exports.default = getUrlHashParams;
27
+ const _default = getUrlHashParams;
@@ -3,11 +3,9 @@
3
3
  * string or, if not provided, failling back reading the `location.hash`
4
4
  *
5
5
  * @category location
6
- */
7
- export function getUrlHashParams(hash) {
8
- if (hash === void 0) { hash = ""; }
6
+ */ export function getUrlHashParams(hash = "") {
9
7
  hash = hash || location.hash;
10
- var hashParts = hash.split("?");
8
+ const hashParts = hash.split("?");
11
9
  if (hashParts.length >= 1) {
12
10
  return Object.fromEntries(new URLSearchParams(hashParts[1]));
13
11
  }
@@ -1,17 +1,29 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getUrlHashPathname = void 0;
4
1
  /**
5
2
  * It returns the "pathname" cleaned up from the `#` and the initial slashes
6
3
  * extracting it from the given `hash` string or, if not provided, failling
7
4
  * back reading the `location.hash`
8
5
  *
9
6
  * @category location
10
- */
11
- function getUrlHashPathname(hash) {
12
- if (hash === void 0) { hash = ""; }
7
+ */ "use strict";
8
+ Object.defineProperty(exports, "__esModule", {
9
+ value: true
10
+ });
11
+ function _export(target, all) {
12
+ for(var name in all)Object.defineProperty(target, name, {
13
+ enumerable: true,
14
+ get: all[name]
15
+ });
16
+ }
17
+ _export(exports, {
18
+ getUrlHashPathname: function() {
19
+ return getUrlHashPathname;
20
+ },
21
+ default: function() {
22
+ return _default;
23
+ }
24
+ });
25
+ function getUrlHashPathname(hash = "") {
13
26
  hash = hash || location.hash;
14
27
  return hash.split("?")[0].replace(/^#\//, "");
15
28
  }
16
- exports.getUrlHashPathname = getUrlHashPathname;
17
- exports.default = getUrlHashPathname;
29
+ const _default = getUrlHashPathname;
@@ -4,9 +4,7 @@
4
4
  * back reading the `location.hash`
5
5
  *
6
6
  * @category location
7
- */
8
- export function getUrlHashPathname(hash) {
9
- if (hash === void 0) { hash = ""; }
7
+ */ export function getUrlHashPathname(hash = "") {
10
8
  hash = hash || location.hash;
11
9
  return hash.split("?")[0].replace(/^#\//, "");
12
10
  }
@@ -1,25 +1,25 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getUrlPathnameParts = void 0;
4
- var tslib_1 = require("tslib");
5
- var isBrowser_1 = tslib_1.__importDefault(require("./isBrowser"));
6
- /**
7
- * Get pathname parts
8
- *
9
- * First clean the pathname from the first slash if any then split the pathname
10
- * in parts,
11
- * Given a pathname like: `"/en/{prefix}/{collection}/{slug}"` we obtain
12
- * `[locale, prefix, collection, slug]`
13
- *
14
- * @category location
15
- */
16
- function getUrlPathnameParts(pathname) {
17
- if (pathname === void 0) { pathname = ""; }
18
- pathname = pathname || isBrowser_1.default ? location.pathname : "";
19
- return pathname
20
- .replace(/^\//, "")
21
- .split("/")
22
- .filter(function (part) { return part; });
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
23
10
  }
24
- exports.getUrlPathnameParts = getUrlPathnameParts;
25
- exports.default = getUrlPathnameParts;
11
+ _export(exports, {
12
+ getUrlPathnameParts: function() {
13
+ return getUrlPathnameParts;
14
+ },
15
+ default: function() {
16
+ return _default;
17
+ }
18
+ });
19
+ const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
20
+ const _isBrowser = /*#__PURE__*/ _interop_require_default._(require("./isBrowser"));
21
+ function getUrlPathnameParts(pathname = "") {
22
+ pathname = pathname || _isBrowser.default ? location.pathname : "";
23
+ return pathname.replace(/^\//, "").split("/").filter((part)=>part);
24
+ }
25
+ const _default = getUrlPathnameParts;
@@ -8,13 +8,8 @@ import isBrowser from "./isBrowser";
8
8
  * `[locale, prefix, collection, slug]`
9
9
  *
10
10
  * @category location
11
- */
12
- export function getUrlPathnameParts(pathname) {
13
- if (pathname === void 0) { pathname = ""; }
11
+ */ export function getUrlPathnameParts(pathname = "") {
14
12
  pathname = pathname || isBrowser ? location.pathname : "";
15
- return pathname
16
- .replace(/^\//, "")
17
- .split("/")
18
- .filter(function (part) { return part; });
13
+ return pathname.replace(/^\//, "").split("/").filter((part)=>part);
19
14
  }
20
15
  export default getUrlPathnameParts;
@@ -1,43 +1,36 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getUrlQueryParams = void 0;
4
- var tslib_1 = require("tslib");
5
- var isBrowser_1 = tslib_1.__importDefault(require("./isBrowser"));
6
- /**
7
- * Get parsed query parameters as object dictionary (from URL or given query string)
8
- *
9
- * @category location
10
- * @param url A URL which contains a `?`, e.g. `?myparam=x` or `https://a.com?myparams=x`.
11
- * If not provided it defaults reading the current URL query string with
12
- * `location.search`. Through this argument you can use this
13
- * same function to parse, for instance, the query params of
14
- * the `href` of a `<a href="...">` HTML tag.
15
- *
16
- */
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
10
+ }
11
+ _export(exports, {
12
+ getUrlQueryParams: function() {
13
+ return getUrlQueryParams;
14
+ },
15
+ default: function() {
16
+ return _default;
17
+ }
18
+ });
19
+ const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
20
+ const _isBrowser = /*#__PURE__*/ _interop_require_default._(require("./isBrowser"));
17
21
  function getUrlQueryParams(url) {
18
- var _a;
19
- var params = {};
20
- var search = url
21
- ? (_a = url.split("?")) === null || _a === void 0 ? void 0 : _a[1]
22
- : isBrowser_1.default
23
- ? location.search.substring(1)
24
- : "";
22
+ let params = {};
23
+ const search = url ? url.split("?")?.[1] : _isBrowser.default ? location.search.substring(1) : "";
25
24
  if (!search) {
26
25
  return {};
27
26
  }
28
27
  try {
29
28
  // @see https://stackoverflow.com/a/8649003/1938970
30
- var paramsAsObj = "{\"".concat(search
31
- .replace(/&/g, '","')
32
- .replace(/=/g, '":"'), "\"}");
33
- params = JSON.parse(paramsAsObj, function (key, value) {
34
- return key === "" ? value : decodeURIComponent(value);
35
- });
36
- }
37
- catch (e) {
38
- // do nothing or warn on process.env["NODE_ENV"] !== "production"
29
+ const paramsAsObj = `{"${search.replace(/&/g, '","').replace(/=/g, '":"')}"}`;
30
+ params = JSON.parse(paramsAsObj, (key, value)=>key === "" ? value : decodeURIComponent(value));
31
+ } catch (e) {
32
+ // do nothing or warn on process.env["NODE_ENV"] !== "production"
39
33
  }
40
34
  return params;
41
35
  }
42
- exports.getUrlQueryParams = getUrlQueryParams;
43
- exports.default = getUrlQueryParams;
36
+ const _default = getUrlQueryParams;
@@ -9,29 +9,18 @@ import isBrowser from "./isBrowser";
9
9
  * same function to parse, for instance, the query params of
10
10
  * the `href` of a `<a href="...">` HTML tag.
11
11
  *
12
- */
13
- export function getUrlQueryParams(url) {
14
- var _a;
15
- var params = {};
16
- var search = url
17
- ? (_a = url.split("?")) === null || _a === void 0 ? void 0 : _a[1]
18
- : isBrowser
19
- ? location.search.substring(1)
20
- : "";
12
+ */ export function getUrlQueryParams(url) {
13
+ let params = {};
14
+ const search = url ? url.split("?")?.[1] : isBrowser ? location.search.substring(1) : "";
21
15
  if (!search) {
22
16
  return {};
23
17
  }
24
18
  try {
25
19
  // @see https://stackoverflow.com/a/8649003/1938970
26
- var paramsAsObj = "{\"".concat(search
27
- .replace(/&/g, '","')
28
- .replace(/=/g, '":"'), "\"}");
29
- params = JSON.parse(paramsAsObj, function (key, value) {
30
- return key === "" ? value : decodeURIComponent(value);
31
- });
32
- }
33
- catch (e) {
34
- // do nothing or warn on process.env["NODE_ENV"] !== "production"
20
+ const paramsAsObj = `{"${search.replace(/&/g, '","').replace(/=/g, '":"')}"}`;
21
+ params = JSON.parse(paramsAsObj, (key, value)=>key === "" ? value : decodeURIComponent(value));
22
+ } catch (e) {
23
+ // do nothing or warn on process.env["NODE_ENV"] !== "production"
35
24
  }
36
25
  return params;
37
26
  }
package/imgEmptyPixel.js CHANGED
@@ -1,10 +1,24 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.imgEmptyPixel = void 0;
4
1
  /**
5
2
  * Empty img pixel as a string to inline
6
3
  *
7
4
  * @category img
8
- */
9
- exports.imgEmptyPixel = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=";
10
- exports.default = exports.imgEmptyPixel;
5
+ */ "use strict";
6
+ Object.defineProperty(exports, "__esModule", {
7
+ value: true
8
+ });
9
+ function _export(target, all) {
10
+ for(var name in all)Object.defineProperty(target, name, {
11
+ enumerable: true,
12
+ get: all[name]
13
+ });
14
+ }
15
+ _export(exports, {
16
+ imgEmptyPixel: function() {
17
+ return imgEmptyPixel;
18
+ },
19
+ default: function() {
20
+ return _default;
21
+ }
22
+ });
23
+ const imgEmptyPixel = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=";
24
+ const _default = imgEmptyPixel;
package/imgEmptyPixel.mjs CHANGED
@@ -2,6 +2,5 @@
2
2
  * Empty img pixel as a string to inline
3
3
  *
4
4
  * @category img
5
- */
6
- export var imgEmptyPixel = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=";
5
+ */ export const imgEmptyPixel = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=";
7
6
  export default imgEmptyPixel;
package/index.d.ts CHANGED
@@ -10,7 +10,7 @@ export { changeUrlPath } from "./changeUrlPath";
10
10
  export { chunkByChunks } from "./chunkByChunks";
11
11
  export { chunkBySize } from "./chunkBySize";
12
12
  export { clamp } from "./clamp";
13
- export { clsx } from "./clsx";
13
+ export { clsx, type ClsxClassValue } from "./clsx";
14
14
  export { convertRange } from "./convertRange";
15
15
  export { type CookieAttributesClient, type CookieAttributesServer, } from "./cookie";
16
16
  export { createPalette } from "./createPalette";