@koine/utils 1.1.9 → 1.1.11

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 (340) hide show
  1. package/Defer.js +6 -2
  2. package/{node/Defer.js → Defer.mjs} +2 -6
  3. package/Emitter.js +6 -2
  4. package/{node/Emitter.js → Emitter.mjs} +2 -6
  5. package/accentSets.js +5 -2
  6. package/{node/accentSets.js → accentSets.mjs} +2 -5
  7. package/addOrReplaceAtIdx.js +8 -4
  8. package/addOrReplaceAtIdx.mjs +19 -0
  9. package/areEqual.js +10 -6
  10. package/{node/areEqual.js → areEqual.mjs} +6 -10
  11. package/arrayOfAll.d.ts +0 -2
  12. package/arrayOfAll.js +6 -4
  13. package/{node/arrayOfAll.js → arrayOfAll.mjs} +2 -8
  14. package/arraySum.js +6 -2
  15. package/arraySum.mjs +9 -0
  16. package/arrayToLookup.js +6 -2
  17. package/{node/arrayToLookup.js → arrayToLookup.mjs} +2 -6
  18. package/buildUrlQueryString.js +12 -7
  19. package/{node/buildUrlQueryString.js → buildUrlQueryString.mjs} +7 -12
  20. package/capitalize.js +6 -2
  21. package/{node/capitalize.js → capitalize.mjs} +2 -6
  22. package/changeUrlPath.js +11 -6
  23. package/changeUrlPath.mjs +18 -0
  24. package/chunkByChunks.js +6 -2
  25. package/{node/chunkByChunks.js → chunkByChunks.mjs} +2 -6
  26. package/chunkBySize.js +6 -2
  27. package/{node/chunkBySize.js → chunkBySize.mjs} +2 -6
  28. package/clamp.js +6 -2
  29. package/{node/clamp.js → clamp.mjs} +2 -6
  30. package/clsx.js +6 -2
  31. package/{node/clsx.js → clsx.mjs} +2 -6
  32. package/convertRange.js +6 -2
  33. package/{node/convertRange.js → convertRange.mjs} +2 -6
  34. package/cookie.js +4 -1
  35. package/{node/cookie.js → cookie.mjs} +1 -4
  36. package/debounce.js +6 -2
  37. package/{node/debounce.js → debounce.mjs} +2 -6
  38. package/debouncePromise.js +6 -3
  39. package/debouncePromise.mjs +9 -0
  40. package/debounceRaf.js +6 -2
  41. package/{node/debounceRaf.js → debounceRaf.mjs} +2 -6
  42. package/decode.js +6 -2
  43. package/{node/decode.js → decode.mjs} +2 -6
  44. package/encode.js +6 -2
  45. package/{node/encode.js → encode.mjs} +2 -6
  46. package/ensureInt.js +6 -2
  47. package/ensureInt.mjs +9 -0
  48. package/{node/env.js → env.mjs} +0 -0
  49. package/findDuplicatedIndexes.js +6 -2
  50. package/{node/findDuplicatedIndexes.js → findDuplicatedIndexes.mjs} +2 -6
  51. package/forin.js +6 -2
  52. package/forin.mjs +11 -0
  53. package/gbToBytes.js +6 -2
  54. package/gbToBytes.mjs +7 -0
  55. package/getEmptyArray.js +9 -4
  56. package/getEmptyArray.mjs +15 -0
  57. package/getKeys.js +5 -2
  58. package/{node/getKeys.js → getKeys.mjs} +2 -5
  59. package/getMediaQueryWidthResolvers.js +8 -4
  60. package/{node/getMediaQueryWidthResolvers.js → getMediaQueryWidthResolvers.mjs} +4 -8
  61. package/getMediaQueryWidthTailwindScreens.js +8 -4
  62. package/{node/getMediaQueryWidthTailwindScreens.js → getMediaQueryWidthTailwindScreens.mjs} +4 -8
  63. package/getNonce.js +8 -4
  64. package/getNonce.mjs +9 -0
  65. package/getParamAmong.js +9 -4
  66. package/{node/getParamAmong.js → getParamAmong.mjs} +4 -9
  67. package/getParamAsInt.js +9 -4
  68. package/{node/getParamAsInt.js → getParamAsInt.mjs} +4 -9
  69. package/getParamAsString.js +9 -4
  70. package/getParamAsString.mjs +14 -0
  71. package/getType.js +6 -2
  72. package/{node/getType.js → getType.mjs} +2 -6
  73. package/getUrlHashParams.js +6 -2
  74. package/{node/getUrlHashParams.js → getUrlHashParams.mjs} +2 -6
  75. package/getUrlHashPathname.js +6 -2
  76. package/{node/getUrlHashPathname.js → getUrlHashPathname.mjs} +2 -6
  77. package/getUrlPathnameParts.js +9 -4
  78. package/{node/getUrlPathnameParts.js → getUrlPathnameParts.mjs} +4 -9
  79. package/getUrlQueryParams.js +9 -4
  80. package/{node/getUrlQueryParams.js → getUrlQueryParams.mjs} +4 -9
  81. package/imgEmptyPixel.js +5 -2
  82. package/imgEmptyPixel.mjs +7 -0
  83. package/index.js +132 -129
  84. package/index.mjs +131 -0
  85. package/invariant.js +6 -2
  86. package/{node/invariant.js → invariant.mjs} +2 -6
  87. package/isAnyObject.js +9 -4
  88. package/isAnyObject.mjs +10 -0
  89. package/isArray.js +9 -4
  90. package/isArray.mjs +10 -0
  91. package/isBlob.js +9 -4
  92. package/isBlob.mjs +10 -0
  93. package/isBoolean.js +9 -4
  94. package/isBoolean.mjs +10 -0
  95. package/isBrowser.js +5 -2
  96. package/isBrowser.mjs +8 -0
  97. package/isDate.js +9 -4
  98. package/isDate.mjs +10 -0
  99. package/isEmptyArray.js +9 -4
  100. package/isEmptyArray.mjs +10 -0
  101. package/isEmptyObject.js +9 -4
  102. package/isEmptyObject.mjs +10 -0
  103. package/isEmptyString.js +6 -2
  104. package/isEmptyString.mjs +9 -0
  105. package/isError.js +9 -4
  106. package/isError.mjs +10 -0
  107. package/isExternalUrl.js +9 -4
  108. package/{node/isExternalUrl.js → isExternalUrl.mjs} +4 -9
  109. package/isFile.js +9 -4
  110. package/isFile.mjs +10 -0
  111. package/isFloat.js +9 -4
  112. package/isFloat.mjs +10 -0
  113. package/isFormData.js +9 -4
  114. package/isFormData.mjs +10 -0
  115. package/isFullArray.js +9 -4
  116. package/isFullArray.mjs +10 -0
  117. package/isFullObject.js +9 -4
  118. package/isFullObject.mjs +10 -0
  119. package/isFullString.js +9 -4
  120. package/isFullString.mjs +10 -0
  121. package/isFunction.js +6 -2
  122. package/isFunction.mjs +9 -0
  123. package/isInt.js +9 -4
  124. package/isInt.mjs +10 -0
  125. package/isMap.js +9 -4
  126. package/isMap.mjs +10 -0
  127. package/isNaNValue.js +9 -4
  128. package/isNaNValue.mjs +10 -0
  129. package/isNegativeNumber.js +9 -4
  130. package/isNegativeNumber.mjs +10 -0
  131. package/isNull.js +9 -4
  132. package/isNull.mjs +10 -0
  133. package/isNullOrUndefined.js +9 -5
  134. package/isNullOrUndefined.mjs +10 -0
  135. package/isNumber.js +9 -4
  136. package/isNumber.mjs +12 -0
  137. package/isObject.js +9 -4
  138. package/isObject.mjs +10 -0
  139. package/isObjectLike.js +9 -4
  140. package/isObjectLike.mjs +12 -0
  141. package/isOneOf.js +6 -2
  142. package/isOneOf.mjs +10 -0
  143. package/isPlainObject.js +9 -4
  144. package/isPlainObject.mjs +13 -0
  145. package/isPositiveNumber.js +9 -4
  146. package/isPositiveNumber.mjs +10 -0
  147. package/isPrimitive.js +19 -14
  148. package/isPrimitive.mjs +20 -0
  149. package/isPromise.js +9 -4
  150. package/isPromise.mjs +10 -0
  151. package/isRegExp.js +9 -4
  152. package/isRegExp.mjs +10 -0
  153. package/isServer.js +7 -3
  154. package/isServer.mjs +9 -0
  155. package/isSet.js +9 -4
  156. package/isSet.mjs +10 -0
  157. package/isString.js +9 -4
  158. package/isString.mjs +10 -0
  159. package/isSymbol.js +9 -4
  160. package/isSymbol.mjs +10 -0
  161. package/isType.js +9 -4
  162. package/{node/isType.js → isType.mjs} +4 -9
  163. package/isUndefined.js +9 -4
  164. package/isUndefined.mjs +10 -0
  165. package/isWeakMap.js +9 -4
  166. package/isWeakMap.mjs +10 -0
  167. package/isWeakSet.js +9 -4
  168. package/isWeakSet.mjs +10 -0
  169. package/kbToBytes.js +6 -2
  170. package/kbToBytes.mjs +7 -0
  171. package/location.js +2 -1
  172. package/location.mjs +1 -0
  173. package/lowercase.js +6 -2
  174. package/lowercase.mjs +9 -0
  175. package/mapListBy.js +6 -2
  176. package/{node/mapListBy.js → mapListBy.mjs} +2 -6
  177. package/matchSorter.js +11 -7
  178. package/{node/matchSorter.js → matchSorter.mjs} +7 -11
  179. package/mbToBytes.js +6 -2
  180. package/mbToBytes.mjs +7 -0
  181. package/mergeObjects.js +11 -7
  182. package/{node/mergeObjects.js → mergeObjects.mjs} +7 -11
  183. package/mergeUrlQueryParams.js +9 -4
  184. package/{node/mergeUrlQueryParams.js → mergeUrlQueryParams.mjs} +4 -9
  185. package/moveSortableArrayItemByKey.js +8 -4
  186. package/{node/moveSortableArrayItemByKey.js → moveSortableArrayItemByKey.mjs} +4 -8
  187. package/noop.js +6 -2
  188. package/noop.mjs +7 -0
  189. package/normaliseUrl.js +9 -4
  190. package/normaliseUrl.mjs +15 -0
  191. package/normaliseUrlPathname.js +9 -4
  192. package/normaliseUrlPathname.mjs +14 -0
  193. package/objectOmit.js +6 -2
  194. package/{node/objectOmit.js → objectOmit.mjs} +2 -6
  195. package/objectPick.js +6 -2
  196. package/{node/objectPick.js → objectPick.mjs} +2 -6
  197. package/package.json +4 -3
  198. package/parseCookie.js +6 -2
  199. package/{node/parseCookie.js → parseCookie.mjs} +2 -6
  200. package/parseURL.js +6 -2
  201. package/{node/parseURL.js → parseURL.mjs} +2 -6
  202. package/quaranteneProps.js +6 -2
  203. package/{node/quaranteneProps.js → quaranteneProps.mjs} +2 -6
  204. package/randomInt.js +6 -2
  205. package/randomInt.mjs +9 -0
  206. package/randomKey.js +6 -2
  207. package/{node/randomKey.js → randomKey.mjs} +2 -6
  208. package/readCookie.js +6 -2
  209. package/{node/readCookie.js → readCookie.mjs} +2 -6
  210. package/removeAccents.js +8 -4
  211. package/removeAccents.mjs +15 -0
  212. package/removeCookie.js +10 -6
  213. package/removeCookie.mjs +15 -0
  214. package/{node/removeDuplicates.js → removeDuplicates.mjs} +0 -0
  215. package/removeDuplicatesByKey.js +6 -2
  216. package/{node/removeDuplicatesByKey.js → removeDuplicatesByKey.mjs} +2 -6
  217. package/removeDuplicatesComparing.js +10 -6
  218. package/removeDuplicatesComparing.mjs +10 -0
  219. package/removeIndexesFromArray.js +6 -2
  220. package/removeIndexesFromArray.mjs +14 -0
  221. package/removeTrailingSlash.js +6 -2
  222. package/removeTrailingSlash.mjs +10 -0
  223. package/removeUrlQueryParams.js +11 -6
  224. package/removeUrlQueryParams.mjs +21 -0
  225. package/roundTo.js +6 -2
  226. package/{node/roundTo.js → roundTo.mjs} +2 -6
  227. package/serializeCookie.js +8 -4
  228. package/{node/serializeCookie.js → serializeCookie.mjs} +4 -8
  229. package/setCookie.js +14 -10
  230. package/{node/setCookie.js → setCookie.mjs} +10 -14
  231. package/shuffle.js +8 -4
  232. package/{node/shuffle.js → shuffle.mjs} +4 -8
  233. package/slugify.js +9 -5
  234. package/{node/slugify.js → slugify.mjs} +5 -9
  235. package/swapMap.js +6 -2
  236. package/{node/swapMap.js → swapMap.mjs} +2 -6
  237. package/throttle.js +8 -4
  238. package/{node/throttle.js → throttle.mjs} +4 -8
  239. package/titleCase.js +6 -2
  240. package/{node/titleCase.js → titleCase.mjs} +2 -6
  241. package/toNumber.js +8 -4
  242. package/toNumber.mjs +8 -0
  243. package/toRgba.js +6 -2
  244. package/{node/toRgba.js → toRgba.mjs} +2 -6
  245. package/transformToUrlPathname.js +9 -4
  246. package/transformToUrlPathname.mjs +16 -0
  247. package/truncate.js +6 -2
  248. package/truncate.mjs +13 -0
  249. package/tryUntil.js +6 -2
  250. package/{node/tryUntil.js → tryUntil.mjs} +2 -6
  251. package/types.js +2 -1
  252. package/types.mjs +1 -0
  253. package/uid.js +6 -2
  254. package/{node/uid.js → uid.mjs} +2 -6
  255. package/updateLinkParams.js +9 -4
  256. package/updateLinkParams.mjs +14 -0
  257. package/updateUrlQueryParams.js +12 -7
  258. package/updateUrlQueryParams.mjs +18 -0
  259. package/uppercase.js +6 -2
  260. package/uppercase.mjs +9 -0
  261. package/uuid.js +6 -2
  262. package/{node/uuid.js → uuid.mjs} +2 -6
  263. package/uuidNumeric.js +6 -2
  264. package/uuidNumeric.mjs +6 -0
  265. package/wait.js +6 -2
  266. package/wait.mjs +9 -0
  267. package/node/addOrReplaceAtIdx.js +0 -23
  268. package/node/arraySum.js +0 -13
  269. package/node/changeUrlPath.js +0 -23
  270. package/node/debouncePromise.js +0 -12
  271. package/node/ensureInt.js +0 -13
  272. package/node/forin.js +0 -15
  273. package/node/gbToBytes.js +0 -11
  274. package/node/getEmptyArray.js +0 -20
  275. package/node/getNonce.js +0 -13
  276. package/node/getParamAsString.js +0 -19
  277. package/node/imgEmptyPixel.js +0 -10
  278. package/node/index.js +0 -134
  279. package/node/isAnyObject.js +0 -15
  280. package/node/isArray.js +0 -15
  281. package/node/isBlob.js +0 -15
  282. package/node/isBoolean.js +0 -15
  283. package/node/isBrowser.js +0 -11
  284. package/node/isDate.js +0 -15
  285. package/node/isEmptyArray.js +0 -15
  286. package/node/isEmptyObject.js +0 -15
  287. package/node/isEmptyString.js +0 -13
  288. package/node/isError.js +0 -15
  289. package/node/isFile.js +0 -15
  290. package/node/isFloat.js +0 -15
  291. package/node/isFormData.js +0 -15
  292. package/node/isFullArray.js +0 -15
  293. package/node/isFullObject.js +0 -15
  294. package/node/isFullString.js +0 -15
  295. package/node/isFunction.js +0 -13
  296. package/node/isInt.js +0 -15
  297. package/node/isMap.js +0 -15
  298. package/node/isNaNValue.js +0 -15
  299. package/node/isNegativeNumber.js +0 -15
  300. package/node/isNull.js +0 -15
  301. package/node/isNullOrUndefined.js +0 -14
  302. package/node/isNumber.js +0 -17
  303. package/node/isObject.js +0 -15
  304. package/node/isObjectLike.js +0 -17
  305. package/node/isOneOf.js +0 -14
  306. package/node/isPlainObject.js +0 -18
  307. package/node/isPositiveNumber.js +0 -15
  308. package/node/isPrimitive.js +0 -25
  309. package/node/isPromise.js +0 -15
  310. package/node/isRegExp.js +0 -15
  311. package/node/isServer.js +0 -13
  312. package/node/isSet.js +0 -15
  313. package/node/isString.js +0 -15
  314. package/node/isSymbol.js +0 -15
  315. package/node/isUndefined.js +0 -15
  316. package/node/isWeakMap.js +0 -15
  317. package/node/isWeakSet.js +0 -15
  318. package/node/kbToBytes.js +0 -11
  319. package/node/location.js +0 -2
  320. package/node/lowercase.js +0 -13
  321. package/node/mbToBytes.js +0 -11
  322. package/node/noop.js +0 -11
  323. package/node/normaliseUrl.js +0 -20
  324. package/node/normaliseUrlPathname.js +0 -19
  325. package/node/randomInt.js +0 -13
  326. package/node/removeAccents.js +0 -19
  327. package/node/removeCookie.js +0 -19
  328. package/node/removeDuplicatesComparing.js +0 -14
  329. package/node/removeIndexesFromArray.js +0 -18
  330. package/node/removeTrailingSlash.js +0 -14
  331. package/node/removeUrlQueryParams.js +0 -26
  332. package/node/toNumber.js +0 -12
  333. package/node/transformToUrlPathname.js +0 -21
  334. package/node/truncate.js +0 -17
  335. package/node/types.js +0 -2
  336. package/node/updateLinkParams.js +0 -19
  337. package/node/updateUrlQueryParams.js +0 -23
  338. package/node/uppercase.js +0 -13
  339. package/node/uuidNumeric.js +0 -10
  340. package/node/wait.js +0 -13
package/getParamAmong.js CHANGED
@@ -1,4 +1,8 @@
1
- import getParamAsString from "./getParamAsString";
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getParamAmong = void 0;
4
+ var tslib_1 = require("tslib");
5
+ var getParamAsString_1 = tslib_1.__importDefault(require("./getParamAsString"));
2
6
  /**
3
7
  * Get query parameter as `string` treating the `ParsedUrlQuery` result of
4
8
  * [`querystring`](https://nodejs.org/api/querystring.html) (used in next.js
@@ -9,9 +13,10 @@ import getParamAsString from "./getParamAsString";
9
13
  * @param {string} [raw] - The _raw_ query parameter
10
14
  * @param {string[]} [allowedValues=[]] - The list of values (as strings) that the parameter can have, if not one of them `null` is returned
11
15
  */
12
- export function getParamAmong(raw, allowedValues) {
16
+ function getParamAmong(raw, allowedValues) {
13
17
  if (allowedValues === void 0) { allowedValues = []; }
14
- var string = getParamAsString(raw);
18
+ var string = (0, getParamAsString_1.default)(raw);
15
19
  return allowedValues.includes(string) ? string : null;
16
20
  }
17
- export default getParamAmong;
21
+ exports.getParamAmong = getParamAmong;
22
+ exports.default = getParamAmong;
@@ -1,8 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getParamAmong = void 0;
4
- var tslib_1 = require("tslib");
5
- var getParamAsString_1 = tslib_1.__importDefault(require("./getParamAsString"));
1
+ import getParamAsString from "./getParamAsString";
6
2
  /**
7
3
  * Get query parameter as `string` treating the `ParsedUrlQuery` result of
8
4
  * [`querystring`](https://nodejs.org/api/querystring.html) (used in next.js
@@ -13,10 +9,9 @@ var getParamAsString_1 = tslib_1.__importDefault(require("./getParamAsString"));
13
9
  * @param {string} [raw] - The _raw_ query parameter
14
10
  * @param {string[]} [allowedValues=[]] - The list of values (as strings) that the parameter can have, if not one of them `null` is returned
15
11
  */
16
- function getParamAmong(raw, allowedValues) {
12
+ export function getParamAmong(raw, allowedValues) {
17
13
  if (allowedValues === void 0) { allowedValues = []; }
18
- var string = (0, getParamAsString_1.default)(raw);
14
+ var string = getParamAsString(raw);
19
15
  return allowedValues.includes(string) ? string : null;
20
16
  }
21
- exports.getParamAmong = getParamAmong;
22
- exports.default = getParamAmong;
17
+ export default getParamAmong;
package/getParamAsInt.js CHANGED
@@ -1,4 +1,8 @@
1
- import getParamAsString from "./getParamAsString";
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getParamAsInt = void 0;
4
+ var tslib_1 = require("tslib");
5
+ var getParamAsString_1 = tslib_1.__importDefault(require("./getParamAsString"));
2
6
  /**
3
7
  * Get query parameter as `int`eger treating the `ParsedUrlQuery` result of
4
8
  * [`querystring`](https://nodejs.org/api/querystring.html) (used in next.js
@@ -9,12 +13,13 @@ import getParamAsString from "./getParamAsString";
9
13
  * @param {string} [raw] - The _raw_ query parameter
10
14
  * @param {number} [fallback] - Fallback number, we return `null` if not provided
11
15
  */
12
- export function getParamAsInt(raw, fallback) {
16
+ function getParamAsInt(raw, fallback) {
13
17
  if (fallback === void 0) { fallback = null; }
14
- var string = getParamAsString(raw);
18
+ var string = (0, getParamAsString_1.default)(raw);
15
19
  if (string) {
16
20
  return parseInt(string, 10);
17
21
  }
18
22
  return fallback;
19
23
  }
20
- export default getParamAsInt;
24
+ exports.getParamAsInt = getParamAsInt;
25
+ exports.default = getParamAsInt;
@@ -1,8 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getParamAsInt = void 0;
4
- var tslib_1 = require("tslib");
5
- var getParamAsString_1 = tslib_1.__importDefault(require("./getParamAsString"));
1
+ import getParamAsString from "./getParamAsString";
6
2
  /**
7
3
  * Get query parameter as `int`eger treating the `ParsedUrlQuery` result of
8
4
  * [`querystring`](https://nodejs.org/api/querystring.html) (used in next.js
@@ -13,13 +9,12 @@ var getParamAsString_1 = tslib_1.__importDefault(require("./getParamAsString"));
13
9
  * @param {string} [raw] - The _raw_ query parameter
14
10
  * @param {number} [fallback] - Fallback number, we return `null` if not provided
15
11
  */
16
- function getParamAsInt(raw, fallback) {
12
+ export function getParamAsInt(raw, fallback) {
17
13
  if (fallback === void 0) { fallback = null; }
18
- var string = (0, getParamAsString_1.default)(raw);
14
+ var string = getParamAsString(raw);
19
15
  if (string) {
20
16
  return parseInt(string, 10);
21
17
  }
22
18
  return fallback;
23
19
  }
24
- exports.getParamAsInt = getParamAsInt;
25
- exports.default = getParamAsInt;
20
+ export default getParamAsInt;
@@ -1,4 +1,8 @@
1
- import isArray from "./isArray";
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getParamAsString = void 0;
4
+ var tslib_1 = require("tslib");
5
+ var isArray_1 = tslib_1.__importDefault(require("./isArray"));
2
6
  /**
3
7
  * Get query parameter as `string` treating the `ParsedUrlQuery` result of
4
8
  * [`querystring`](https://nodejs.org/api/querystring.html) (used in next.js
@@ -8,7 +12,8 @@ import isArray from "./isArray";
8
12
  *
9
13
  * @param {string} [raw] - The _raw_ query parameter
10
14
  */
11
- export function getParamAsString(raw) {
12
- return (isArray(raw) ? raw[0] : raw) || "";
15
+ function getParamAsString(raw) {
16
+ return ((0, isArray_1.default)(raw) ? raw[0] : raw) || "";
13
17
  }
14
- export default getParamAsString;
18
+ exports.getParamAsString = getParamAsString;
19
+ exports.default = getParamAsString;
@@ -0,0 +1,14 @@
1
+ import isArray from "./isArray";
2
+ /**
3
+ * Get query parameter as `string` treating the `ParsedUrlQuery` result of
4
+ * [`querystring`](https://nodejs.org/api/querystring.html) (used in next.js
5
+ * router and elsewhere)
6
+ *
7
+ * @category location
8
+ *
9
+ * @param {string} [raw] - The _raw_ query parameter
10
+ */
11
+ export function getParamAsString(raw) {
12
+ return (isArray(raw) ? raw[0] : raw) || "";
13
+ }
14
+ export default getParamAsString;
package/getType.js CHANGED
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  /**
2
3
  * @file
3
4
  *
@@ -7,13 +8,16 @@
7
8
  * - `isInt`
8
9
  * - `isFloat`
9
10
  */
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.getType = void 0;
10
13
  /**
11
14
  * Returns the object type of the given payload
12
15
  *
13
16
  * @param {*} payload
14
17
  * @returns {string}
15
18
  */
16
- export function getType(payload) {
19
+ function getType(payload) {
17
20
  return Object.prototype.toString.call(payload).slice(8, -1);
18
21
  }
19
- export default getType;
22
+ exports.getType = getType;
23
+ exports.default = getType;
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  /**
3
2
  * @file
4
3
  *
@@ -8,16 +7,13 @@
8
7
  * - `isInt`
9
8
  * - `isFloat`
10
9
  */
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.getType = void 0;
13
10
  /**
14
11
  * Returns the object type of the given payload
15
12
  *
16
13
  * @param {*} payload
17
14
  * @returns {string}
18
15
  */
19
- function getType(payload) {
16
+ export function getType(payload) {
20
17
  return Object.prototype.toString.call(payload).slice(8, -1);
21
18
  }
22
- exports.getType = getType;
23
- exports.default = getType;
19
+ export default getType;
@@ -1,10 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getUrlHashParams = void 0;
1
4
  /**
2
5
  * It returns the "query params" as an object extracting it from the given `hash`
3
6
  * string or, if not provided, failling back reading the `location.hash`
4
7
  *
5
8
  * @category location
6
9
  */
7
- export function getUrlHashParams(hash) {
10
+ function getUrlHashParams(hash) {
8
11
  if (hash === void 0) { hash = ""; }
9
12
  hash = hash || location.hash;
10
13
  var hashParts = hash.split("?");
@@ -13,4 +16,5 @@ export function getUrlHashParams(hash) {
13
16
  }
14
17
  return {};
15
18
  }
16
- export default getUrlHashParams;
19
+ exports.getUrlHashParams = getUrlHashParams;
20
+ exports.default = getUrlHashParams;
@@ -1,13 +1,10 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getUrlHashParams = void 0;
4
1
  /**
5
2
  * It returns the "query params" as an object extracting it from the given `hash`
6
3
  * string or, if not provided, failling back reading the `location.hash`
7
4
  *
8
5
  * @category location
9
6
  */
10
- function getUrlHashParams(hash) {
7
+ export function getUrlHashParams(hash) {
11
8
  if (hash === void 0) { hash = ""; }
12
9
  hash = hash || location.hash;
13
10
  var hashParts = hash.split("?");
@@ -16,5 +13,4 @@ function getUrlHashParams(hash) {
16
13
  }
17
14
  return {};
18
15
  }
19
- exports.getUrlHashParams = getUrlHashParams;
20
- exports.default = getUrlHashParams;
16
+ export default getUrlHashParams;
@@ -1,3 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getUrlHashPathname = void 0;
1
4
  /**
2
5
  * It returns the "pathname" cleaned up from the `#` and the initial slashes
3
6
  * extracting it from the given `hash` string or, if not provided, failling
@@ -5,9 +8,10 @@
5
8
  *
6
9
  * @category location
7
10
  */
8
- export function getUrlHashPathname(hash) {
11
+ function getUrlHashPathname(hash) {
9
12
  if (hash === void 0) { hash = ""; }
10
13
  hash = hash || location.hash;
11
14
  return hash.split("?")[0].replace(/^#\//, "");
12
15
  }
13
- export default getUrlHashPathname;
16
+ exports.getUrlHashPathname = getUrlHashPathname;
17
+ exports.default = getUrlHashPathname;
@@ -1,6 +1,3 @@
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
@@ -8,10 +5,9 @@ exports.getUrlHashPathname = void 0;
8
5
  *
9
6
  * @category location
10
7
  */
11
- function getUrlHashPathname(hash) {
8
+ export function getUrlHashPathname(hash) {
12
9
  if (hash === void 0) { hash = ""; }
13
10
  hash = hash || location.hash;
14
11
  return hash.split("?")[0].replace(/^#\//, "");
15
12
  }
16
- exports.getUrlHashPathname = getUrlHashPathname;
17
- exports.default = getUrlHashPathname;
13
+ export default getUrlHashPathname;
@@ -1,4 +1,8 @@
1
- import isBrowser from "./isBrowser";
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"));
2
6
  /**
3
7
  * Get pathname parts
4
8
  *
@@ -9,12 +13,13 @@ import isBrowser from "./isBrowser";
9
13
  *
10
14
  * @category location
11
15
  */
12
- export function getUrlPathnameParts(pathname) {
16
+ function getUrlPathnameParts(pathname) {
13
17
  if (pathname === void 0) { pathname = ""; }
14
- pathname = pathname || isBrowser ? location.pathname : "";
18
+ pathname = pathname || isBrowser_1.default ? location.pathname : "";
15
19
  return pathname
16
20
  .replace(/^\//, "")
17
21
  .split("/")
18
22
  .filter(function (part) { return part; });
19
23
  }
20
- export default getUrlPathnameParts;
24
+ exports.getUrlPathnameParts = getUrlPathnameParts;
25
+ exports.default = getUrlPathnameParts;
@@ -1,8 +1,4 @@
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"));
1
+ import isBrowser from "./isBrowser";
6
2
  /**
7
3
  * Get pathname parts
8
4
  *
@@ -13,13 +9,12 @@ var isBrowser_1 = tslib_1.__importDefault(require("./isBrowser"));
13
9
  *
14
10
  * @category location
15
11
  */
16
- function getUrlPathnameParts(pathname) {
12
+ export function getUrlPathnameParts(pathname) {
17
13
  if (pathname === void 0) { pathname = ""; }
18
- pathname = pathname || isBrowser_1.default ? location.pathname : "";
14
+ pathname = pathname || isBrowser ? location.pathname : "";
19
15
  return pathname
20
16
  .replace(/^\//, "")
21
17
  .split("/")
22
18
  .filter(function (part) { return part; });
23
19
  }
24
- exports.getUrlPathnameParts = getUrlPathnameParts;
25
- exports.default = getUrlPathnameParts;
20
+ export default getUrlPathnameParts;
@@ -1,4 +1,8 @@
1
- import isBrowser from "./isBrowser";
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"));
2
6
  /**
3
7
  * Get parsed query parameters as object dictionary (from URL or given query string)
4
8
  *
@@ -10,12 +14,12 @@ import isBrowser from "./isBrowser";
10
14
  * the `href` of a `<a href="...">` HTML tag.
11
15
  *
12
16
  */
13
- export function getUrlQueryParams(url) {
17
+ function getUrlQueryParams(url) {
14
18
  var _a;
15
19
  var params = {};
16
20
  var search = url
17
21
  ? (_a = url.split("?")) === null || _a === void 0 ? void 0 : _a[1]
18
- : isBrowser
22
+ : isBrowser_1.default
19
23
  ? location.search.substring(1)
20
24
  : "";
21
25
  if (!search) {
@@ -35,4 +39,5 @@ export function getUrlQueryParams(url) {
35
39
  }
36
40
  return params;
37
41
  }
38
- export default getUrlQueryParams;
42
+ exports.getUrlQueryParams = getUrlQueryParams;
43
+ exports.default = getUrlQueryParams;
@@ -1,8 +1,4 @@
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"));
1
+ import isBrowser from "./isBrowser";
6
2
  /**
7
3
  * Get parsed query parameters as object dictionary (from URL or given query string)
8
4
  *
@@ -14,12 +10,12 @@ var isBrowser_1 = tslib_1.__importDefault(require("./isBrowser"));
14
10
  * the `href` of a `<a href="...">` HTML tag.
15
11
  *
16
12
  */
17
- function getUrlQueryParams(url) {
13
+ export function getUrlQueryParams(url) {
18
14
  var _a;
19
15
  var params = {};
20
16
  var search = url
21
17
  ? (_a = url.split("?")) === null || _a === void 0 ? void 0 : _a[1]
22
- : isBrowser_1.default
18
+ : isBrowser
23
19
  ? location.search.substring(1)
24
20
  : "";
25
21
  if (!search) {
@@ -39,5 +35,4 @@ function getUrlQueryParams(url) {
39
35
  }
40
36
  return params;
41
37
  }
42
- exports.getUrlQueryParams = getUrlQueryParams;
43
- exports.default = getUrlQueryParams;
38
+ export default getUrlQueryParams;
package/imgEmptyPixel.js CHANGED
@@ -1,7 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.imgEmptyPixel = void 0;
1
4
  /**
2
5
  * Empty img pixel as a string to inline
3
6
  *
4
7
  * @category img
5
8
  */
6
- export var imgEmptyPixel = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=";
7
- export default imgEmptyPixel;
9
+ exports.imgEmptyPixel = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=";
10
+ exports.default = exports.imgEmptyPixel;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Empty img pixel as a string to inline
3
+ *
4
+ * @category img
5
+ */
6
+ export var imgEmptyPixel = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=";
7
+ export default imgEmptyPixel;