@koine/utils 1.1.10 → 1.1.12

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 (339) 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.js +6 -2
  12. package/{node/arrayOfAll.js → arrayOfAll.mjs} +2 -6
  13. package/arraySum.js +6 -2
  14. package/arraySum.mjs +9 -0
  15. package/arrayToLookup.js +6 -2
  16. package/{node/arrayToLookup.js → arrayToLookup.mjs} +2 -6
  17. package/buildUrlQueryString.js +12 -7
  18. package/{node/buildUrlQueryString.js → buildUrlQueryString.mjs} +7 -12
  19. package/capitalize.js +6 -2
  20. package/{node/capitalize.js → capitalize.mjs} +2 -6
  21. package/changeUrlPath.js +11 -6
  22. package/changeUrlPath.mjs +18 -0
  23. package/chunkByChunks.js +6 -2
  24. package/{node/chunkByChunks.js → chunkByChunks.mjs} +2 -6
  25. package/chunkBySize.js +6 -2
  26. package/{node/chunkBySize.js → chunkBySize.mjs} +2 -6
  27. package/clamp.js +6 -2
  28. package/{node/clamp.js → clamp.mjs} +2 -6
  29. package/clsx.js +6 -2
  30. package/{node/clsx.js → clsx.mjs} +2 -6
  31. package/convertRange.js +6 -2
  32. package/{node/convertRange.js → convertRange.mjs} +2 -6
  33. package/cookie.js +4 -1
  34. package/{node/cookie.js → cookie.mjs} +1 -4
  35. package/debounce.js +6 -2
  36. package/{node/debounce.js → debounce.mjs} +2 -6
  37. package/debouncePromise.js +6 -3
  38. package/debouncePromise.mjs +9 -0
  39. package/debounceRaf.js +6 -2
  40. package/{node/debounceRaf.js → debounceRaf.mjs} +2 -6
  41. package/decode.js +6 -2
  42. package/{node/decode.js → decode.mjs} +2 -6
  43. package/encode.js +6 -2
  44. package/{node/encode.js → encode.mjs} +2 -6
  45. package/ensureInt.js +6 -2
  46. package/ensureInt.mjs +9 -0
  47. package/{node/env.js → env.mjs} +0 -0
  48. package/findDuplicatedIndexes.js +6 -2
  49. package/{node/findDuplicatedIndexes.js → findDuplicatedIndexes.mjs} +2 -6
  50. package/forin.js +6 -2
  51. package/forin.mjs +11 -0
  52. package/gbToBytes.js +6 -2
  53. package/gbToBytes.mjs +7 -0
  54. package/getEmptyArray.js +9 -4
  55. package/getEmptyArray.mjs +15 -0
  56. package/getKeys.js +5 -2
  57. package/{node/getKeys.js → getKeys.mjs} +2 -5
  58. package/getMediaQueryWidthResolvers.js +8 -4
  59. package/{node/getMediaQueryWidthResolvers.js → getMediaQueryWidthResolvers.mjs} +4 -8
  60. package/getMediaQueryWidthTailwindScreens.js +8 -4
  61. package/{node/getMediaQueryWidthTailwindScreens.js → getMediaQueryWidthTailwindScreens.mjs} +4 -8
  62. package/getNonce.js +8 -4
  63. package/getNonce.mjs +9 -0
  64. package/getParamAmong.js +9 -4
  65. package/{node/getParamAmong.js → getParamAmong.mjs} +4 -9
  66. package/getParamAsInt.js +9 -4
  67. package/{node/getParamAsInt.js → getParamAsInt.mjs} +4 -9
  68. package/getParamAsString.js +9 -4
  69. package/getParamAsString.mjs +14 -0
  70. package/getType.js +6 -2
  71. package/{node/getType.js → getType.mjs} +2 -6
  72. package/getUrlHashParams.js +6 -2
  73. package/{node/getUrlHashParams.js → getUrlHashParams.mjs} +2 -6
  74. package/getUrlHashPathname.js +6 -2
  75. package/{node/getUrlHashPathname.js → getUrlHashPathname.mjs} +2 -6
  76. package/getUrlPathnameParts.js +9 -4
  77. package/{node/getUrlPathnameParts.js → getUrlPathnameParts.mjs} +4 -9
  78. package/getUrlQueryParams.js +9 -4
  79. package/{node/getUrlQueryParams.js → getUrlQueryParams.mjs} +4 -9
  80. package/imgEmptyPixel.js +5 -2
  81. package/imgEmptyPixel.mjs +7 -0
  82. package/index.js +132 -129
  83. package/index.mjs +131 -0
  84. package/invariant.js +6 -2
  85. package/{node/invariant.js → invariant.mjs} +2 -6
  86. package/isAnyObject.js +9 -4
  87. package/isAnyObject.mjs +10 -0
  88. package/isArray.js +9 -4
  89. package/isArray.mjs +10 -0
  90. package/isBlob.js +9 -4
  91. package/isBlob.mjs +10 -0
  92. package/isBoolean.js +9 -4
  93. package/isBoolean.mjs +10 -0
  94. package/isBrowser.js +5 -2
  95. package/isBrowser.mjs +8 -0
  96. package/isDate.js +9 -4
  97. package/isDate.mjs +10 -0
  98. package/isEmptyArray.js +9 -4
  99. package/isEmptyArray.mjs +10 -0
  100. package/isEmptyObject.js +9 -4
  101. package/isEmptyObject.mjs +10 -0
  102. package/isEmptyString.js +6 -2
  103. package/isEmptyString.mjs +9 -0
  104. package/isError.js +9 -4
  105. package/isError.mjs +10 -0
  106. package/isExternalUrl.js +9 -4
  107. package/{node/isExternalUrl.js → isExternalUrl.mjs} +4 -9
  108. package/isFile.js +9 -4
  109. package/isFile.mjs +10 -0
  110. package/isFloat.js +9 -4
  111. package/isFloat.mjs +10 -0
  112. package/isFormData.js +9 -4
  113. package/isFormData.mjs +10 -0
  114. package/isFullArray.js +9 -4
  115. package/isFullArray.mjs +10 -0
  116. package/isFullObject.js +9 -4
  117. package/isFullObject.mjs +10 -0
  118. package/isFullString.js +9 -4
  119. package/isFullString.mjs +10 -0
  120. package/isFunction.js +6 -2
  121. package/isFunction.mjs +9 -0
  122. package/isInt.js +9 -4
  123. package/isInt.mjs +10 -0
  124. package/isMap.js +9 -4
  125. package/isMap.mjs +10 -0
  126. package/isNaNValue.js +9 -4
  127. package/isNaNValue.mjs +10 -0
  128. package/isNegativeNumber.js +9 -4
  129. package/isNegativeNumber.mjs +10 -0
  130. package/isNull.js +9 -4
  131. package/isNull.mjs +10 -0
  132. package/isNullOrUndefined.js +9 -5
  133. package/isNullOrUndefined.mjs +10 -0
  134. package/isNumber.js +9 -4
  135. package/isNumber.mjs +12 -0
  136. package/isObject.js +9 -4
  137. package/isObject.mjs +10 -0
  138. package/isObjectLike.js +9 -4
  139. package/isObjectLike.mjs +12 -0
  140. package/isOneOf.js +6 -2
  141. package/isOneOf.mjs +10 -0
  142. package/isPlainObject.js +9 -4
  143. package/isPlainObject.mjs +13 -0
  144. package/isPositiveNumber.js +9 -4
  145. package/isPositiveNumber.mjs +10 -0
  146. package/isPrimitive.js +19 -14
  147. package/isPrimitive.mjs +20 -0
  148. package/isPromise.js +9 -4
  149. package/isPromise.mjs +10 -0
  150. package/isRegExp.js +9 -4
  151. package/isRegExp.mjs +10 -0
  152. package/isServer.js +7 -3
  153. package/isServer.mjs +9 -0
  154. package/isSet.js +9 -4
  155. package/isSet.mjs +10 -0
  156. package/isString.js +9 -4
  157. package/isString.mjs +10 -0
  158. package/isSymbol.js +9 -4
  159. package/isSymbol.mjs +10 -0
  160. package/isType.js +9 -4
  161. package/{node/isType.js → isType.mjs} +4 -9
  162. package/isUndefined.js +9 -4
  163. package/isUndefined.mjs +10 -0
  164. package/isWeakMap.js +9 -4
  165. package/isWeakMap.mjs +10 -0
  166. package/isWeakSet.js +9 -4
  167. package/isWeakSet.mjs +10 -0
  168. package/kbToBytes.js +6 -2
  169. package/kbToBytes.mjs +7 -0
  170. package/location.js +2 -1
  171. package/location.mjs +1 -0
  172. package/lowercase.js +6 -2
  173. package/lowercase.mjs +9 -0
  174. package/mapListBy.js +6 -2
  175. package/{node/mapListBy.js → mapListBy.mjs} +2 -6
  176. package/matchSorter.js +11 -7
  177. package/{node/matchSorter.js → matchSorter.mjs} +7 -11
  178. package/mbToBytes.js +6 -2
  179. package/mbToBytes.mjs +7 -0
  180. package/mergeObjects.js +11 -7
  181. package/{node/mergeObjects.js → mergeObjects.mjs} +7 -11
  182. package/mergeUrlQueryParams.js +9 -4
  183. package/{node/mergeUrlQueryParams.js → mergeUrlQueryParams.mjs} +4 -9
  184. package/moveSortableArrayItemByKey.js +8 -4
  185. package/{node/moveSortableArrayItemByKey.js → moveSortableArrayItemByKey.mjs} +4 -8
  186. package/noop.js +6 -2
  187. package/noop.mjs +7 -0
  188. package/normaliseUrl.js +9 -4
  189. package/normaliseUrl.mjs +15 -0
  190. package/normaliseUrlPathname.js +9 -4
  191. package/normaliseUrlPathname.mjs +14 -0
  192. package/objectOmit.js +6 -2
  193. package/{node/objectOmit.js → objectOmit.mjs} +2 -6
  194. package/objectPick.js +6 -2
  195. package/{node/objectPick.js → objectPick.mjs} +2 -6
  196. package/package.json +10 -8
  197. package/parseCookie.js +6 -2
  198. package/{node/parseCookie.js → parseCookie.mjs} +2 -6
  199. package/parseURL.js +6 -2
  200. package/{node/parseURL.js → parseURL.mjs} +2 -6
  201. package/quaranteneProps.js +6 -2
  202. package/{node/quaranteneProps.js → quaranteneProps.mjs} +2 -6
  203. package/randomInt.js +6 -2
  204. package/randomInt.mjs +9 -0
  205. package/randomKey.js +6 -2
  206. package/{node/randomKey.js → randomKey.mjs} +2 -6
  207. package/readCookie.js +6 -2
  208. package/{node/readCookie.js → readCookie.mjs} +2 -6
  209. package/removeAccents.js +8 -4
  210. package/removeAccents.mjs +15 -0
  211. package/removeCookie.js +10 -6
  212. package/removeCookie.mjs +15 -0
  213. package/{node/removeDuplicates.js → removeDuplicates.mjs} +0 -0
  214. package/removeDuplicatesByKey.js +6 -2
  215. package/{node/removeDuplicatesByKey.js → removeDuplicatesByKey.mjs} +2 -6
  216. package/removeDuplicatesComparing.js +10 -6
  217. package/removeDuplicatesComparing.mjs +10 -0
  218. package/removeIndexesFromArray.js +6 -2
  219. package/removeIndexesFromArray.mjs +14 -0
  220. package/removeTrailingSlash.js +6 -2
  221. package/removeTrailingSlash.mjs +10 -0
  222. package/removeUrlQueryParams.js +11 -6
  223. package/removeUrlQueryParams.mjs +21 -0
  224. package/roundTo.js +6 -2
  225. package/{node/roundTo.js → roundTo.mjs} +2 -6
  226. package/serializeCookie.js +8 -4
  227. package/{node/serializeCookie.js → serializeCookie.mjs} +4 -8
  228. package/setCookie.js +14 -10
  229. package/{node/setCookie.js → setCookie.mjs} +10 -14
  230. package/shuffle.js +8 -4
  231. package/{node/shuffle.js → shuffle.mjs} +4 -8
  232. package/slugify.js +9 -5
  233. package/{node/slugify.js → slugify.mjs} +5 -9
  234. package/swapMap.js +6 -2
  235. package/{node/swapMap.js → swapMap.mjs} +2 -6
  236. package/throttle.js +8 -4
  237. package/{node/throttle.js → throttle.mjs} +4 -8
  238. package/titleCase.js +6 -2
  239. package/{node/titleCase.js → titleCase.mjs} +2 -6
  240. package/toNumber.js +8 -4
  241. package/toNumber.mjs +8 -0
  242. package/toRgba.js +6 -2
  243. package/{node/toRgba.js → toRgba.mjs} +2 -6
  244. package/transformToUrlPathname.js +9 -4
  245. package/transformToUrlPathname.mjs +16 -0
  246. package/truncate.js +6 -2
  247. package/truncate.mjs +13 -0
  248. package/tryUntil.js +6 -2
  249. package/{node/tryUntil.js → tryUntil.mjs} +2 -6
  250. package/types.js +2 -1
  251. package/types.mjs +1 -0
  252. package/uid.js +6 -2
  253. package/{node/uid.js → uid.mjs} +2 -6
  254. package/updateLinkParams.js +9 -4
  255. package/updateLinkParams.mjs +14 -0
  256. package/updateUrlQueryParams.js +12 -7
  257. package/updateUrlQueryParams.mjs +18 -0
  258. package/uppercase.js +6 -2
  259. package/uppercase.mjs +9 -0
  260. package/uuid.js +6 -2
  261. package/{node/uuid.js → uuid.mjs} +2 -6
  262. package/uuidNumeric.js +6 -2
  263. package/uuidNumeric.mjs +6 -0
  264. package/wait.js +6 -2
  265. package/wait.mjs +9 -0
  266. package/node/addOrReplaceAtIdx.js +0 -23
  267. package/node/arraySum.js +0 -13
  268. package/node/changeUrlPath.js +0 -23
  269. package/node/debouncePromise.js +0 -12
  270. package/node/ensureInt.js +0 -13
  271. package/node/forin.js +0 -15
  272. package/node/gbToBytes.js +0 -11
  273. package/node/getEmptyArray.js +0 -20
  274. package/node/getNonce.js +0 -13
  275. package/node/getParamAsString.js +0 -19
  276. package/node/imgEmptyPixel.js +0 -10
  277. package/node/index.js +0 -134
  278. package/node/isAnyObject.js +0 -15
  279. package/node/isArray.js +0 -15
  280. package/node/isBlob.js +0 -15
  281. package/node/isBoolean.js +0 -15
  282. package/node/isBrowser.js +0 -11
  283. package/node/isDate.js +0 -15
  284. package/node/isEmptyArray.js +0 -15
  285. package/node/isEmptyObject.js +0 -15
  286. package/node/isEmptyString.js +0 -13
  287. package/node/isError.js +0 -15
  288. package/node/isFile.js +0 -15
  289. package/node/isFloat.js +0 -15
  290. package/node/isFormData.js +0 -15
  291. package/node/isFullArray.js +0 -15
  292. package/node/isFullObject.js +0 -15
  293. package/node/isFullString.js +0 -15
  294. package/node/isFunction.js +0 -13
  295. package/node/isInt.js +0 -15
  296. package/node/isMap.js +0 -15
  297. package/node/isNaNValue.js +0 -15
  298. package/node/isNegativeNumber.js +0 -15
  299. package/node/isNull.js +0 -15
  300. package/node/isNullOrUndefined.js +0 -14
  301. package/node/isNumber.js +0 -17
  302. package/node/isObject.js +0 -15
  303. package/node/isObjectLike.js +0 -17
  304. package/node/isOneOf.js +0 -14
  305. package/node/isPlainObject.js +0 -18
  306. package/node/isPositiveNumber.js +0 -15
  307. package/node/isPrimitive.js +0 -25
  308. package/node/isPromise.js +0 -15
  309. package/node/isRegExp.js +0 -15
  310. package/node/isServer.js +0 -13
  311. package/node/isSet.js +0 -15
  312. package/node/isString.js +0 -15
  313. package/node/isSymbol.js +0 -15
  314. package/node/isUndefined.js +0 -15
  315. package/node/isWeakMap.js +0 -15
  316. package/node/isWeakSet.js +0 -15
  317. package/node/kbToBytes.js +0 -11
  318. package/node/location.js +0 -2
  319. package/node/lowercase.js +0 -13
  320. package/node/mbToBytes.js +0 -11
  321. package/node/noop.js +0 -11
  322. package/node/normaliseUrl.js +0 -20
  323. package/node/normaliseUrlPathname.js +0 -19
  324. package/node/randomInt.js +0 -13
  325. package/node/removeAccents.js +0 -19
  326. package/node/removeCookie.js +0 -19
  327. package/node/removeDuplicatesComparing.js +0 -14
  328. package/node/removeIndexesFromArray.js +0 -18
  329. package/node/removeTrailingSlash.js +0 -14
  330. package/node/removeUrlQueryParams.js +0 -26
  331. package/node/toNumber.js +0 -12
  332. package/node/transformToUrlPathname.js +0 -21
  333. package/node/truncate.js +0 -17
  334. package/node/types.js +0 -2
  335. package/node/updateLinkParams.js +0 -19
  336. package/node/updateUrlQueryParams.js +0 -23
  337. package/node/uppercase.js +0 -13
  338. package/node/uuidNumeric.js +0 -10
  339. package/node/wait.js +0 -13
@@ -1,10 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.setCookie = void 0;
4
- var tslib_1 = require("tslib");
5
- var cookie_1 = require("./cookie");
6
- var isNumber_1 = tslib_1.__importDefault(require("./isNumber"));
7
- var isUndefined_1 = tslib_1.__importDefault(require("./isUndefined"));
1
+ import { __assign, __rest } from "tslib";
2
+ import { defaultAttributesClient } from "./cookie";
3
+ import isNumber from "./isNumber";
4
+ import isUndefined from "./isUndefined";
8
5
  function converterWrite(value) {
9
6
  return encodeURIComponent(value).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g, decodeURIComponent);
10
7
  }
@@ -15,18 +12,18 @@ function converterWrite(value) {
15
12
  * - [js-cookie](https://github.com/js-cookie/js-cookie)
16
13
  * - [cookie](https://github.com/jshttp/cookie)
17
14
  */
18
- function setCookie(name, value, attributes) {
15
+ export function setCookie(name, value, attributes) {
19
16
  if (attributes === void 0) { attributes = {}; }
20
17
  // eslint-disable-next-line prefer-const
21
- var expires = attributes.expires, restAttrs = tslib_1.__rest(attributes, ["expires"]);
22
- var cleanedAttrs = tslib_1.__assign(tslib_1.__assign({ expires: "" }, cookie_1.defaultAttributesClient), restAttrs);
23
- if ((0, isUndefined_1.default)(document)) {
18
+ var expires = attributes.expires, restAttrs = __rest(attributes, ["expires"]);
19
+ var cleanedAttrs = __assign(__assign({ expires: "" }, defaultAttributesClient), restAttrs);
20
+ if (isUndefined(document)) {
24
21
  if (process.env["NODE_ENV"] !== "production") {
25
22
  console.warn("[@koine/utils:setCookie] document is undefined");
26
23
  }
27
24
  return undefined;
28
25
  }
29
- if ((0, isNumber_1.default)(expires)) {
26
+ if (isNumber(expires)) {
30
27
  expires = new Date(Date.now() + expires * 864e5);
31
28
  }
32
29
  if (expires) {
@@ -58,5 +55,4 @@ function setCookie(name, value, attributes) {
58
55
  return (document.cookie =
59
56
  name + "=" + converterWrite(value) + stringifiedAttributes);
60
57
  }
61
- exports.setCookie = setCookie;
62
- exports.default = setCookie;
58
+ export default setCookie;
package/shuffle.js CHANGED
@@ -1,4 +1,7 @@
1
- import { __spreadArray } from "tslib";
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.shuffle = void 0;
4
+ var tslib_1 = require("tslib");
2
5
  /**
3
6
  * Creates an array of shuffled values, using a version of the
4
7
  * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
@@ -13,14 +16,14 @@ import { __spreadArray } from "tslib";
13
16
  * shuffle([1, 2, 3, 4])
14
17
  * // => [4, 1, 3, 2]
15
18
  */
16
- export function shuffle(array) {
19
+ function shuffle(array) {
17
20
  var length = array == null ? 0 : array.length;
18
21
  if (!length) {
19
22
  return [];
20
23
  }
21
24
  var index = -1;
22
25
  var lastIndex = length - 1;
23
- var result = __spreadArray([], array, true);
26
+ var result = tslib_1.__spreadArray([], array, true);
24
27
  while (++index < length) {
25
28
  var rand = index + Math.floor(Math.random() * (lastIndex - index + 1));
26
29
  var value = result[rand];
@@ -29,4 +32,5 @@ export function shuffle(array) {
29
32
  }
30
33
  return result;
31
34
  }
32
- export default shuffle;
35
+ exports.shuffle = shuffle;
36
+ exports.default = shuffle;
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.shuffle = void 0;
4
- var tslib_1 = require("tslib");
1
+ import { __spreadArray } from "tslib";
5
2
  /**
6
3
  * Creates an array of shuffled values, using a version of the
7
4
  * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
@@ -16,14 +13,14 @@ var tslib_1 = require("tslib");
16
13
  * shuffle([1, 2, 3, 4])
17
14
  * // => [4, 1, 3, 2]
18
15
  */
19
- function shuffle(array) {
16
+ export function shuffle(array) {
20
17
  var length = array == null ? 0 : array.length;
21
18
  if (!length) {
22
19
  return [];
23
20
  }
24
21
  var index = -1;
25
22
  var lastIndex = length - 1;
26
- var result = tslib_1.__spreadArray([], array, true);
23
+ var result = __spreadArray([], array, true);
27
24
  while (++index < length) {
28
25
  var rand = index + Math.floor(Math.random() * (lastIndex - index + 1));
29
26
  var value = result[rand];
@@ -32,5 +29,4 @@ function shuffle(array) {
32
29
  }
33
30
  return result;
34
31
  }
35
- exports.shuffle = shuffle;
36
- exports.default = shuffle;
32
+ export default shuffle;
package/slugify.js CHANGED
@@ -1,5 +1,8 @@
1
- import { accentsSets } from "./accentSets";
2
- import { removeAccents } from "./removeAccents";
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.slugify = void 0;
4
+ var accentSets_1 = require("./accentSets");
5
+ var removeAccents_1 = require("./removeAccents");
3
6
  /**
4
7
  * Slugify a text
5
8
  *
@@ -9,9 +12,9 @@ import { removeAccents } from "./removeAccents";
9
12
  * @category text
10
13
  * @see https://gist.github.com/mathewbyrne/1280286#gistcomment-3498021
11
14
  */
12
- export function slugify(text, separator) {
15
+ function slugify(text, separator) {
13
16
  if (separator === void 0) { separator = "-"; }
14
- return removeAccents(text.toString().toLowerCase().trim(), accentsSets.concat([["-", "[·/_,:;']"]]))
17
+ return (0, removeAccents_1.removeAccents)(text.toString().toLowerCase().trim(), accentSets_1.accentsSets.concat([["-", "[·/_,:;']"]]))
15
18
  .replace(/\s+/g, "-") // replace spaces with -
16
19
  .replace(/&/g, "-and-") // replace & with 'and'
17
20
  .replace(/[^\w-]+/g, "") // remove all non-word chars
@@ -20,4 +23,5 @@ export function slugify(text, separator) {
20
23
  .replace(/-+$/, "") // trim - from end of text
21
24
  .replace(/-/g, separator);
22
25
  }
23
- export default slugify;
26
+ exports.slugify = slugify;
27
+ exports.default = slugify;
@@ -1,8 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.slugify = void 0;
4
- var accentSets_1 = require("./accentSets");
5
- var removeAccents_1 = require("./removeAccents");
1
+ import { accentsSets } from "./accentSets";
2
+ import { removeAccents } from "./removeAccents";
6
3
  /**
7
4
  * Slugify a text
8
5
  *
@@ -12,9 +9,9 @@ var removeAccents_1 = require("./removeAccents");
12
9
  * @category text
13
10
  * @see https://gist.github.com/mathewbyrne/1280286#gistcomment-3498021
14
11
  */
15
- function slugify(text, separator) {
12
+ export function slugify(text, separator) {
16
13
  if (separator === void 0) { separator = "-"; }
17
- return (0, removeAccents_1.removeAccents)(text.toString().toLowerCase().trim(), accentSets_1.accentsSets.concat([["-", "[·/_,:;']"]]))
14
+ return removeAccents(text.toString().toLowerCase().trim(), accentsSets.concat([["-", "[·/_,:;']"]]))
18
15
  .replace(/\s+/g, "-") // replace spaces with -
19
16
  .replace(/&/g, "-and-") // replace & with 'and'
20
17
  .replace(/[^\w-]+/g, "") // remove all non-word chars
@@ -23,5 +20,4 @@ function slugify(text, separator) {
23
20
  .replace(/-+$/, "") // trim - from end of text
24
21
  .replace(/-/g, separator);
25
22
  }
26
- exports.slugify = slugify;
27
- exports.default = slugify;
23
+ export default slugify;
package/swapMap.js CHANGED
@@ -1,9 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.swapMap = void 0;
1
4
  /**
2
5
  * Swap object map key/value
3
6
  *
4
7
  * @category objects
5
8
  */
6
- export function swapMap(map) {
9
+ function swapMap(map) {
7
10
  if (map === void 0) { map = {}; }
8
11
  var output = {};
9
12
  for (var key in map) {
@@ -11,4 +14,5 @@ export function swapMap(map) {
11
14
  }
12
15
  return output;
13
16
  }
14
- export default swapMap;
17
+ exports.swapMap = swapMap;
18
+ exports.default = swapMap;
@@ -1,12 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.swapMap = void 0;
4
1
  /**
5
2
  * Swap object map key/value
6
3
  *
7
4
  * @category objects
8
5
  */
9
- function swapMap(map) {
6
+ export function swapMap(map) {
10
7
  if (map === void 0) { map = {}; }
11
8
  var output = {};
12
9
  for (var key in map) {
@@ -14,5 +11,4 @@ function swapMap(map) {
14
11
  }
15
12
  return output;
16
13
  }
17
- exports.swapMap = swapMap;
18
- exports.default = swapMap;
14
+ export default swapMap;
package/throttle.js CHANGED
@@ -1,11 +1,14 @@
1
- import { __spreadArray } from "tslib";
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.throttle = void 0;
4
+ var tslib_1 = require("tslib");
2
5
  /**
3
6
  * Throttle function (e.g. for resize / scroll handlers)
4
7
  *
5
8
  * @category function
6
9
  * @see https://github.com/Mobius1/Rangeable/
7
10
  */
8
- export function throttle(fn, limit, context) {
11
+ function throttle(fn, limit, context) {
9
12
  var wait;
10
13
  return function () {
11
14
  var args = [];
@@ -14,7 +17,7 @@ export function throttle(fn, limit, context) {
14
17
  }
15
18
  context = context || this;
16
19
  if (!wait) {
17
- fn.apply.apply(fn, __spreadArray([context], args, false));
20
+ fn.apply.apply(fn, tslib_1.__spreadArray([context], args, false));
18
21
  wait = true;
19
22
  return setTimeout(function () {
20
23
  wait = false;
@@ -23,4 +26,5 @@ export function throttle(fn, limit, context) {
23
26
  return;
24
27
  };
25
28
  }
26
- export default throttle;
29
+ exports.throttle = throttle;
30
+ exports.default = throttle;
@@ -1,14 +1,11 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.throttle = void 0;
4
- var tslib_1 = require("tslib");
1
+ import { __spreadArray } from "tslib";
5
2
  /**
6
3
  * Throttle function (e.g. for resize / scroll handlers)
7
4
  *
8
5
  * @category function
9
6
  * @see https://github.com/Mobius1/Rangeable/
10
7
  */
11
- function throttle(fn, limit, context) {
8
+ export function throttle(fn, limit, context) {
12
9
  var wait;
13
10
  return function () {
14
11
  var args = [];
@@ -17,7 +14,7 @@ function throttle(fn, limit, context) {
17
14
  }
18
15
  context = context || this;
19
16
  if (!wait) {
20
- fn.apply.apply(fn, tslib_1.__spreadArray([context], args, false));
17
+ fn.apply.apply(fn, __spreadArray([context], args, false));
21
18
  wait = true;
22
19
  return setTimeout(function () {
23
20
  wait = false;
@@ -26,5 +23,4 @@ function throttle(fn, limit, context) {
26
23
  return;
27
24
  };
28
25
  }
29
- exports.throttle = throttle;
30
- exports.default = throttle;
26
+ export default throttle;
package/titleCase.js CHANGED
@@ -1,11 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.titleCase = void 0;
1
4
  /**
2
5
  * @category typography
3
6
  * @see https://github.com/blakeembrey/change-case/blob/master/packages/title-case/src/index.ts
4
7
  * @author Blake Embrey (hello@blakeembrey.com)
5
8
  */
6
- export var titleCase = function (input) {
9
+ var titleCase = function (input) {
7
10
  return input
8
11
  ? input.replace(/\w\S*/g, function (txt) { return txt.charAt(0).toUpperCase() + txt.substring(1).toLowerCase(); })
9
12
  : "";
10
13
  };
11
- export default titleCase;
14
+ exports.titleCase = titleCase;
15
+ exports.default = exports.titleCase;
@@ -1,15 +1,11 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.titleCase = void 0;
4
1
  /**
5
2
  * @category typography
6
3
  * @see https://github.com/blakeembrey/change-case/blob/master/packages/title-case/src/index.ts
7
4
  * @author Blake Embrey (hello@blakeembrey.com)
8
5
  */
9
- var titleCase = function (input) {
6
+ export var titleCase = function (input) {
10
7
  return input
11
8
  ? input.replace(/\w\S*/g, function (txt) { return txt.charAt(0).toUpperCase() + txt.substring(1).toLowerCase(); })
12
9
  : "";
13
10
  };
14
- exports.titleCase = titleCase;
15
- exports.default = exports.titleCase;
11
+ export default titleCase;
package/toNumber.js CHANGED
@@ -1,8 +1,12 @@
1
- import { isNumber } from "./isNumber";
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.toNumber = void 0;
4
+ var isNumber_1 = require("./isNumber");
2
5
  /**
3
6
  * @category cast
4
7
  */
5
- export function toNumber(input, fallback) {
6
- return isNumber(input) ? input : input ? parseFloat(input) : fallback || 0;
8
+ function toNumber(input, fallback) {
9
+ return (0, isNumber_1.isNumber)(input) ? input : input ? parseFloat(input) : fallback || 0;
7
10
  }
8
- export default toNumber;
11
+ exports.toNumber = toNumber;
12
+ exports.default = toNumber;
package/toNumber.mjs ADDED
@@ -0,0 +1,8 @@
1
+ import { isNumber } from "./isNumber";
2
+ /**
3
+ * @category cast
4
+ */
5
+ export function toNumber(input, fallback) {
6
+ return isNumber(input) ? input : input ? parseFloat(input) : fallback || 0;
7
+ }
8
+ export default toNumber;
package/toRgba.js CHANGED
@@ -1,11 +1,14 @@
1
+ "use strict";
1
2
  // import hexRgb from "hex-rgb";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.toRgba = void 0;
2
5
  // export const toRgb = (hexColor: string) => hexRgb(hexColor, { format: "css" });
3
6
  // export const toRgba = (hexColor: string, alpha: number) =>
4
7
  // hexRgb(hexColor, { format: "css", alpha });
5
8
  /**
6
9
  * @category colors
7
10
  */
8
- export function toRgba(hex, alpha) {
11
+ function toRgba(hex, alpha) {
9
12
  if (alpha === void 0) { alpha = 1; }
10
13
  var r = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
11
14
  if (r) {
@@ -13,4 +16,5 @@ export function toRgba(hex, alpha) {
13
16
  }
14
17
  return "";
15
18
  }
16
- export default toRgba;
19
+ exports.toRgba = toRgba;
20
+ exports.default = toRgba;
@@ -1,14 +1,11 @@
1
- "use strict";
2
1
  // import hexRgb from "hex-rgb";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.toRgba = void 0;
5
2
  // export const toRgb = (hexColor: string) => hexRgb(hexColor, { format: "css" });
6
3
  // export const toRgba = (hexColor: string, alpha: number) =>
7
4
  // hexRgb(hexColor, { format: "css", alpha });
8
5
  /**
9
6
  * @category colors
10
7
  */
11
- function toRgba(hex, alpha) {
8
+ export function toRgba(hex, alpha) {
12
9
  if (alpha === void 0) { alpha = 1; }
13
10
  var r = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
14
11
  if (r) {
@@ -16,5 +13,4 @@ function toRgba(hex, alpha) {
16
13
  }
17
14
  return "";
18
15
  }
19
- exports.toRgba = toRgba;
20
- exports.default = toRgba;
16
+ export default toRgba;
@@ -1,4 +1,8 @@
1
- import isString from "./isString";
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.transformToUrlPathname = void 0;
4
+ var tslib_1 = require("tslib");
5
+ var isString_1 = tslib_1.__importDefault(require("./isString"));
2
6
  /**
3
7
  * Transform string in a URL pathname (relative URL)
4
8
  *
@@ -8,9 +12,10 @@ import isString from "./isString";
8
12
  *
9
13
  * @category location
10
14
  */
11
- export function transformToUrlPathname(toPathname) {
12
- return isString(toPathname)
15
+ function transformToUrlPathname(toPathname) {
16
+ return (0, isString_1.default)(toPathname)
13
17
  ? "/".concat(encodeURIComponent(toPathname.replace(/\s/g, "-").toLowerCase()))
14
18
  : "";
15
19
  }
16
- export default transformToUrlPathname;
20
+ exports.transformToUrlPathname = transformToUrlPathname;
21
+ exports.default = transformToUrlPathname;
@@ -0,0 +1,16 @@
1
+ import isString from "./isString";
2
+ /**
3
+ * Transform string in a URL pathname (relative URL)
4
+ *
5
+ * - adds an initial slash
6
+ * - encode the string
7
+ * - replaces whitespaces with dashes
8
+ *
9
+ * @category location
10
+ */
11
+ export function transformToUrlPathname(toPathname) {
12
+ return isString(toPathname)
13
+ ? "/".concat(encodeURIComponent(toPathname.replace(/\s/g, "-").toLowerCase()))
14
+ : "";
15
+ }
16
+ export default transformToUrlPathname;
package/truncate.js CHANGED
@@ -1,13 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.truncate = void 0;
1
4
  /**
2
5
  * Truncate string
3
6
  *
4
7
  * @category typography
5
8
  */
6
- export var truncate = function (input, length) {
9
+ var truncate = function (input, length) {
7
10
  return input
8
11
  ? input.length > length
9
12
  ? input.substring(0, length) + "..."
10
13
  : input
11
14
  : "";
12
15
  };
13
- export default truncate;
16
+ exports.truncate = truncate;
17
+ exports.default = exports.truncate;
package/truncate.mjs ADDED
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Truncate string
3
+ *
4
+ * @category typography
5
+ */
6
+ export var truncate = function (input, length) {
7
+ return input
8
+ ? input.length > length
9
+ ? input.substring(0, length) + "..."
10
+ : input
11
+ : "";
12
+ };
13
+ export default truncate;
package/tryUntil.js CHANGED
@@ -1,10 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.tryUntil = void 0;
1
4
  /**
2
5
  * @borrows [https://levelup.gitconnected.com/javascript-wait-until-something-happens-or-timeout-82636839ea93]
3
6
  *
4
7
  * @param timeout in `ms`
5
8
  * @param interval in `ms`
6
9
  */
7
- export var tryUntil = function (test, timeout, interval, resolve, reject) {
10
+ var tryUntil = function (test, timeout, interval, resolve, reject) {
8
11
  // return new Promise((resolve, reject) => {
9
12
  var timeWas = new Date();
10
13
  var wait = setInterval(function () {
@@ -24,4 +27,5 @@ export var tryUntil = function (test, timeout, interval, resolve, reject) {
24
27
  }, interval);
25
28
  // });
26
29
  };
27
- export default tryUntil;
30
+ exports.tryUntil = tryUntil;
31
+ exports.default = exports.tryUntil;
@@ -1,13 +1,10 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.tryUntil = void 0;
4
1
  /**
5
2
  * @borrows [https://levelup.gitconnected.com/javascript-wait-until-something-happens-or-timeout-82636839ea93]
6
3
  *
7
4
  * @param timeout in `ms`
8
5
  * @param interval in `ms`
9
6
  */
10
- var tryUntil = function (test, timeout, interval, resolve, reject) {
7
+ export var tryUntil = function (test, timeout, interval, resolve, reject) {
11
8
  // return new Promise((resolve, reject) => {
12
9
  var timeWas = new Date();
13
10
  var wait = setInterval(function () {
@@ -27,5 +24,4 @@ var tryUntil = function (test, timeout, interval, resolve, reject) {
27
24
  }, interval);
28
25
  // });
29
26
  };
30
- exports.tryUntil = tryUntil;
31
- exports.default = exports.tryUntil;
27
+ export default tryUntil;
package/types.js CHANGED
@@ -1 +1,2 @@
1
- export {};
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/types.mjs ADDED
@@ -0,0 +1 @@
1
+ export {};
package/uid.js CHANGED
@@ -1,12 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.uid = void 0;
1
4
  var lastId = 0;
2
5
  /**
3
6
  * Super basic UID increment-based generator
4
7
  *
5
8
  * @category uid
6
9
  */
7
- export var uid = function (prefix) {
10
+ var uid = function (prefix) {
8
11
  if (prefix === void 0) { prefix = "id"; }
9
12
  lastId++;
10
13
  return "".concat(prefix, "-").concat(lastId);
11
14
  };
12
- export default uid;
15
+ exports.uid = uid;
16
+ exports.default = exports.uid;
@@ -1,16 +1,12 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.uid = void 0;
4
1
  var lastId = 0;
5
2
  /**
6
3
  * Super basic UID increment-based generator
7
4
  *
8
5
  * @category uid
9
6
  */
10
- var uid = function (prefix) {
7
+ export var uid = function (prefix) {
11
8
  if (prefix === void 0) { prefix = "id"; }
12
9
  lastId++;
13
10
  return "".concat(prefix, "-").concat(lastId);
14
11
  };
15
- exports.uid = uid;
16
- exports.default = exports.uid;
12
+ export default uid;
@@ -1,4 +1,8 @@
1
- import updateUrlQueryParams from "./updateUrlQueryParams";
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateLinkParams = void 0;
4
+ var tslib_1 = require("tslib");
5
+ var updateUrlQueryParams_1 = tslib_1.__importDefault(require("./updateUrlQueryParams"));
2
6
  /**
3
7
  * Update link `<a href="">` merging the given new query parameters.
4
8
  * it returns the newly created `href` URL value
@@ -6,9 +10,10 @@ import updateUrlQueryParams from "./updateUrlQueryParams";
6
10
  * @category location
7
11
  * @pure
8
12
  */
9
- export function updateLinkParams($anchor, newParams) {
10
- var href = updateUrlQueryParams($anchor.href, newParams);
13
+ function updateLinkParams($anchor, newParams) {
14
+ var href = (0, updateUrlQueryParams_1.default)($anchor.href, newParams);
11
15
  $anchor.href = href;
12
16
  return href;
13
17
  }
14
- export default updateLinkParams;
18
+ exports.updateLinkParams = updateLinkParams;
19
+ exports.default = updateLinkParams;
@@ -0,0 +1,14 @@
1
+ import updateUrlQueryParams from "./updateUrlQueryParams";
2
+ /**
3
+ * Update link `<a href="">` merging the given new query parameters.
4
+ * it returns the newly created `href` URL value
5
+ *
6
+ * @category location
7
+ * @pure
8
+ */
9
+ export function updateLinkParams($anchor, newParams) {
10
+ var href = updateUrlQueryParams($anchor.href, newParams);
11
+ $anchor.href = href;
12
+ return href;
13
+ }
14
+ export default updateLinkParams;
@@ -1,18 +1,23 @@
1
- import buildUrlQueryString from "./buildUrlQueryString";
2
- import getUrlQueryParams from "./getUrlQueryParams";
3
- import mergeUrlQueryParams from "./mergeUrlQueryParams";
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateUrlQueryParams = void 0;
4
+ var tslib_1 = require("tslib");
5
+ var buildUrlQueryString_1 = tslib_1.__importDefault(require("./buildUrlQueryString"));
6
+ var getUrlQueryParams_1 = tslib_1.__importDefault(require("./getUrlQueryParams"));
7
+ var mergeUrlQueryParams_1 = tslib_1.__importDefault(require("./mergeUrlQueryParams"));
4
8
  /**
5
9
  * Update a URL string query parameters merging the given new query parameters
6
10
  *
7
11
  * @category location
8
12
  * @pure
9
13
  */
10
- export function updateUrlQueryParams(url, newParams) {
14
+ function updateUrlQueryParams(url, newParams) {
11
15
  if (newParams === void 0) { newParams = {}; }
12
16
  var parts = url.split("?");
13
17
  var allParams = parts[1]
14
- ? mergeUrlQueryParams(getUrlQueryParams(url), newParams)
18
+ ? (0, mergeUrlQueryParams_1.default)((0, getUrlQueryParams_1.default)(url), newParams)
15
19
  : newParams;
16
- return parts[0] + buildUrlQueryString(allParams);
20
+ return parts[0] + (0, buildUrlQueryString_1.default)(allParams);
17
21
  }
18
- export default updateUrlQueryParams;
22
+ exports.updateUrlQueryParams = updateUrlQueryParams;
23
+ exports.default = updateUrlQueryParams;
@@ -0,0 +1,18 @@
1
+ import buildUrlQueryString from "./buildUrlQueryString";
2
+ import getUrlQueryParams from "./getUrlQueryParams";
3
+ import mergeUrlQueryParams from "./mergeUrlQueryParams";
4
+ /**
5
+ * Update a URL string query parameters merging the given new query parameters
6
+ *
7
+ * @category location
8
+ * @pure
9
+ */
10
+ export function updateUrlQueryParams(url, newParams) {
11
+ if (newParams === void 0) { newParams = {}; }
12
+ var parts = url.split("?");
13
+ var allParams = parts[1]
14
+ ? mergeUrlQueryParams(getUrlQueryParams(url), newParams)
15
+ : newParams;
16
+ return parts[0] + buildUrlQueryString(allParams);
17
+ }
18
+ export default updateUrlQueryParams;