@koine/utils 2.0.0-beta.2 → 2.0.0-beta.4

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 (283) 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 +5 -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.js +29 -23
  31. package/clsx.mjs +11 -14
  32. package/convertRange.js +20 -7
  33. package/convertRange.mjs +2 -3
  34. package/cookie.js +13 -5
  35. package/cookie.mjs +3 -2
  36. package/createPalette.js +27 -19
  37. package/createPalette.mjs +9 -6
  38. package/debounce.js +27 -21
  39. package/debounce.mjs +9 -17
  40. package/debouncePromise.js +20 -11
  41. package/debouncePromise.mjs +1 -2
  42. package/debounceRaf.js +23 -14
  43. package/debounceRaf.mjs +5 -10
  44. package/decode.js +20 -7
  45. package/decode.mjs +2 -3
  46. package/encode.js +20 -7
  47. package/encode.mjs +2 -3
  48. package/ensureInt.js +20 -9
  49. package/ensureInt.mjs +1 -4
  50. package/env.js +1 -1
  51. package/env.mjs +0 -1
  52. package/errorToString.js +21 -14
  53. package/errorToString.mjs +1 -4
  54. package/findDuplicatedIndexes.js +22 -9
  55. package/findDuplicatedIndexes.mjs +4 -5
  56. package/forin.js +20 -7
  57. package/forin.mjs +2 -3
  58. package/gbToBytes.js +20 -7
  59. package/gbToBytes.mjs +1 -2
  60. package/getEmptyArray.js +25 -16
  61. package/getEmptyArray.mjs +4 -3
  62. package/getKeys.js +20 -6
  63. package/getKeys.mjs +1 -2
  64. package/getMediaQueryWidthResolvers.js +62 -53
  65. package/getMediaQueryWidthResolvers.mjs +44 -49
  66. package/getMediaQueryWidthTailwindScreens.js +36 -18
  67. package/getMediaQueryWidthTailwindScreens.mjs +18 -14
  68. package/getNonce.js +20 -10
  69. package/getNonce.mjs +1 -2
  70. package/getParamAmong.js +22 -19
  71. package/getParamAmong.mjs +2 -4
  72. package/getParamAsInt.js +22 -19
  73. package/getParamAsInt.mjs +2 -4
  74. package/getParamAsString.js +21 -16
  75. package/getParamAsString.mjs +1 -2
  76. package/getType.js +19 -12
  77. package/getType.mjs +2 -4
  78. package/getUrlHashParams.js +20 -13
  79. package/getUrlHashParams.mjs +2 -4
  80. package/getUrlHashPathname.js +20 -8
  81. package/getUrlHashPathname.mjs +1 -3
  82. package/getUrlPathnameParts.js +23 -23
  83. package/getUrlPathnameParts.mjs +2 -7
  84. package/getUrlQueryParams.js +26 -33
  85. package/getUrlQueryParams.mjs +7 -18
  86. package/imgEmptyPixel.js +20 -6
  87. package/imgEmptyPixel.mjs +1 -2
  88. package/index.js +531 -266
  89. package/index.mjs +2 -2
  90. package/invariant.js +24 -12
  91. package/invariant.mjs +6 -8
  92. package/isAnyObject.js +21 -12
  93. package/isAnyObject.mjs +1 -2
  94. package/isArray.js +21 -12
  95. package/isArray.mjs +1 -2
  96. package/isBlob.js +21 -12
  97. package/isBlob.mjs +1 -2
  98. package/isBoolean.js +21 -12
  99. package/isBoolean.mjs +1 -2
  100. package/isBrowser.js +20 -6
  101. package/isBrowser.mjs +1 -2
  102. package/isBrowserNow.js +21 -11
  103. package/isBrowserNow.mjs +1 -2
  104. package/isDate.js +21 -12
  105. package/isDate.mjs +1 -2
  106. package/isEmptyArray.js +21 -12
  107. package/isEmptyArray.mjs +1 -2
  108. package/isEmptyObject.js +21 -12
  109. package/isEmptyObject.mjs +1 -2
  110. package/isEmptyString.js +19 -6
  111. package/isEmptyString.mjs +1 -2
  112. package/isError.js +21 -12
  113. package/isError.mjs +1 -2
  114. package/isExternalUrl.js +24 -18
  115. package/isExternalUrl.mjs +4 -6
  116. package/isFile.js +21 -12
  117. package/isFile.mjs +1 -2
  118. package/isFloat.js +21 -12
  119. package/isFloat.mjs +1 -2
  120. package/isFormData.js +21 -12
  121. package/isFormData.mjs +1 -2
  122. package/isFullArray.js +21 -12
  123. package/isFullArray.mjs +1 -2
  124. package/isFullObject.js +21 -12
  125. package/isFullObject.mjs +1 -2
  126. package/isFullString.js +21 -12
  127. package/isFullString.mjs +1 -2
  128. package/isFunction.js +18 -9
  129. package/isFunction.mjs +1 -2
  130. package/isInt.js +21 -12
  131. package/isInt.mjs +1 -2
  132. package/isMap.js +21 -12
  133. package/isMap.mjs +1 -2
  134. package/isNaNValue.js +21 -12
  135. package/isNaNValue.mjs +1 -2
  136. package/isNegativeNumber.js +21 -12
  137. package/isNegativeNumber.mjs +1 -2
  138. package/isNull.js +21 -12
  139. package/isNull.mjs +1 -2
  140. package/isNullOrUndefined.js +23 -13
  141. package/isNullOrUndefined.mjs +1 -2
  142. package/isNumber.js +21 -14
  143. package/isNumber.mjs +1 -2
  144. package/isObject.js +21 -12
  145. package/isObject.mjs +1 -2
  146. package/isObjectLike.js +21 -14
  147. package/isObjectLike.mjs +1 -2
  148. package/isOneOf.js +19 -11
  149. package/isOneOf.mjs +1 -7
  150. package/isPlainObject.js +22 -15
  151. package/isPlainObject.mjs +3 -6
  152. package/isPositiveNumber.js +21 -12
  153. package/isPositiveNumber.mjs +1 -2
  154. package/isPrimitive.js +26 -22
  155. package/isPrimitive.mjs +5 -11
  156. package/isPromise.js +21 -12
  157. package/isPromise.mjs +1 -2
  158. package/isRegExp.js +21 -12
  159. package/isRegExp.mjs +1 -2
  160. package/isServer.js +22 -11
  161. package/isServer.mjs +1 -2
  162. package/isServerNow.js +21 -11
  163. package/isServerNow.mjs +1 -2
  164. package/isSet.js +21 -12
  165. package/isSet.mjs +1 -2
  166. package/isString.js +21 -12
  167. package/isString.mjs +1 -2
  168. package/isSymbol.js +21 -12
  169. package/isSymbol.mjs +1 -2
  170. package/isType.js +22 -17
  171. package/isType.mjs +3 -5
  172. package/isUndefined.js +21 -12
  173. package/isUndefined.mjs +1 -2
  174. package/isWeakMap.js +21 -12
  175. package/isWeakMap.mjs +1 -2
  176. package/isWeakSet.js +21 -12
  177. package/isWeakSet.mjs +1 -2
  178. package/kbToBytes.js +20 -7
  179. package/kbToBytes.mjs +1 -2
  180. package/location.js +6 -2
  181. package/location.mjs +3 -1
  182. package/lowercase.js +20 -9
  183. package/lowercase.mjs +1 -4
  184. package/mapListBy.js +21 -10
  185. package/mapListBy.mjs +2 -5
  186. package/matchSorter.js +132 -133
  187. package/matchSorter.mjs +108 -126
  188. package/mbToBytes.js +20 -7
  189. package/mbToBytes.mjs +1 -2
  190. package/mergeObjects.d.ts +1 -1
  191. package/mergeObjects.js +24 -26
  192. package/mergeObjects.mjs +12 -15
  193. package/mergeUrlQueryParams.js +25 -20
  194. package/mergeUrlQueryParams.mjs +4 -8
  195. package/moveSortableArrayItemByKey.js +26 -12
  196. package/moveSortableArrayItemByKey.mjs +8 -8
  197. package/noop.js +20 -7
  198. package/noop.mjs +1 -2
  199. package/normaliseUrl.js +22 -18
  200. package/normaliseUrl.mjs +1 -3
  201. package/normaliseUrlPathname.js +22 -17
  202. package/normaliseUrlPathname.mjs +1 -3
  203. package/objectOmit.js +21 -9
  204. package/objectOmit.mjs +3 -5
  205. package/objectPick.js +22 -9
  206. package/objectPick.mjs +4 -5
  207. package/package.json +11 -8
  208. package/parseCookie.js +29 -26
  209. package/parseCookie.mjs +11 -15
  210. package/parseURL.js +23 -10
  211. package/parseURL.mjs +5 -6
  212. package/quaranteneProps.js +24 -12
  213. package/quaranteneProps.mjs +6 -8
  214. package/randomInt.js +19 -6
  215. package/randomInt.mjs +1 -2
  216. package/randomKey.js +21 -8
  217. package/randomKey.mjs +3 -4
  218. package/readCookie.js +25 -12
  219. package/readCookie.mjs +7 -8
  220. package/removeAccents.js +24 -15
  221. package/removeAccents.mjs +5 -8
  222. package/removeCookie.js +26 -17
  223. package/removeCookie.mjs +6 -5
  224. package/removeDuplicates.js +1 -1
  225. package/removeDuplicates.mjs +0 -1
  226. package/removeDuplicatesByKey.js +24 -12
  227. package/removeDuplicatesByKey.mjs +5 -7
  228. package/removeDuplicatesComparing.js +22 -11
  229. package/removeDuplicatesComparing.mjs +3 -4
  230. package/removeIndexesFromArray.js +21 -8
  231. package/removeIndexesFromArray.mjs +3 -4
  232. package/removeTrailingSlash.js +20 -8
  233. package/removeTrailingSlash.mjs +1 -3
  234. package/removeUrlQueryParams.js +27 -20
  235. package/removeUrlQueryParams.mjs +5 -7
  236. package/render.js +61 -137
  237. package/render.mjs +43 -98
  238. package/roundTo.js +34 -22
  239. package/roundTo.mjs +15 -17
  240. package/serializeCookie.js +29 -35
  241. package/serializeCookie.mjs +9 -15
  242. package/setCookie.js +37 -31
  243. package/setCookie.mjs +13 -16
  244. package/shuffle.js +28 -14
  245. package/shuffle.mjs +10 -10
  246. package/slugify.js +33 -25
  247. package/slugify.mjs +13 -11
  248. package/split.js +18 -4
  249. package/swapMap.js +22 -10
  250. package/swapMap.mjs +3 -5
  251. package/throttle.d.ts +1 -0
  252. package/throttle.js +23 -15
  253. package/throttle.mjs +5 -11
  254. package/titleCase.js +20 -11
  255. package/titleCase.mjs +1 -6
  256. package/toNumber.js +20 -9
  257. package/toNumber.mjs +1 -2
  258. package/toRgba.js +22 -10
  259. package/toRgba.mjs +3 -5
  260. package/transformToUrlPathname.js +21 -18
  261. package/transformToUrlPathname.mjs +2 -5
  262. package/truncate.js +20 -13
  263. package/truncate.mjs +1 -8
  264. package/tryUntil.js +26 -15
  265. package/tryUntil.mjs +7 -10
  266. package/types.js +4 -1
  267. package/types.mjs +2 -1
  268. package/uid.js +21 -13
  269. package/uid.mjs +3 -5
  270. package/updateLinkParams.js +21 -14
  271. package/updateLinkParams.mjs +2 -3
  272. package/updateUrlQueryParams.js +26 -21
  273. package/updateUrlQueryParams.mjs +3 -7
  274. package/uppercase.js +20 -9
  275. package/uppercase.mjs +1 -4
  276. package/uuid.js +21 -10
  277. package/uuid.mjs +2 -5
  278. package/uuidNumeric.js +20 -7
  279. package/uuidNumeric.mjs +1 -2
  280. package/wait.js +20 -9
  281. package/wait.mjs +1 -4
  282. package/without.js +2 -3
  283. package/without.mjs +1 -3
package/chunkByChunks.mjs CHANGED
@@ -2,33 +2,30 @@
2
2
  * TODO: untested
3
3
  * @category array
4
4
  * @see https://stackoverflow.com/a/8189268/1938970
5
- */
6
- export function chunkByChunks(arr, nrOfChunks, balanced) {
7
- if (nrOfChunks < 2)
8
- return [arr];
9
- var len = arr.length;
10
- var output = [];
11
- var i = 0;
12
- var size;
5
+ */ export function chunkByChunks(arr, nrOfChunks, balanced) {
6
+ if (nrOfChunks < 2) return [
7
+ arr
8
+ ];
9
+ const len = arr.length;
10
+ const output = [];
11
+ let i = 0;
12
+ let size;
13
13
  if (len % nrOfChunks === 0) {
14
14
  size = Math.floor(len / nrOfChunks);
15
- while (i < len) {
16
- output.push(arr.slice(i, (i += size)));
15
+ while(i < len){
16
+ output.push(arr.slice(i, i += size));
17
17
  }
18
- }
19
- else if (balanced) {
20
- while (i < len) {
18
+ } else if (balanced) {
19
+ while(i < len){
21
20
  size = Math.ceil((len - i) / nrOfChunks--);
22
- output.push(arr.slice(i, (i += size)));
21
+ output.push(arr.slice(i, i += size));
23
22
  }
24
- }
25
- else {
23
+ } else {
26
24
  nrOfChunks--;
27
25
  size = Math.floor(len / nrOfChunks);
28
- if (len % size === 0)
29
- size--;
30
- while (i < size * nrOfChunks) {
31
- output.push(arr.slice(i, (i += size)));
26
+ if (len % size === 0) size--;
27
+ while(i < size * nrOfChunks){
28
+ output.push(arr.slice(i, i += size));
32
29
  }
33
30
  output.push(arr.slice(size * nrOfChunks));
34
31
  }
package/chunkBySize.js CHANGED
@@ -1,16 +1,29 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.chunkBySize = void 0;
4
1
  /**
5
2
  * @category array
6
3
  * @see https://stackoverflow.com/a/40682136/1938970
7
- */
4
+ */ "use strict";
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ function _export(target, all) {
9
+ for(var name in all)Object.defineProperty(target, name, {
10
+ enumerable: true,
11
+ get: all[name]
12
+ });
13
+ }
14
+ _export(exports, {
15
+ chunkBySize: function() {
16
+ return chunkBySize;
17
+ },
18
+ default: function() {
19
+ return _default;
20
+ }
21
+ });
8
22
  function chunkBySize(arr, size) {
9
- var output = [];
10
- for (var i = 0; i < arr.length; i += size) {
23
+ const output = [];
24
+ for(let i = 0; i < arr.length; i += size){
11
25
  output.push(arr.slice(i, i + size));
12
26
  }
13
27
  return output;
14
28
  }
15
- exports.chunkBySize = chunkBySize;
16
- exports.default = chunkBySize;
29
+ const _default = chunkBySize;
package/chunkBySize.mjs CHANGED
@@ -1,10 +1,9 @@
1
1
  /**
2
2
  * @category array
3
3
  * @see https://stackoverflow.com/a/40682136/1938970
4
- */
5
- export function chunkBySize(arr, size) {
6
- var output = [];
7
- for (var i = 0; i < arr.length; i += size) {
4
+ */ export function chunkBySize(arr, size) {
5
+ const output = [];
6
+ for(let i = 0; i < arr.length; i += size){
8
7
  output.push(arr.slice(i, i + size));
9
8
  }
10
9
  return output;
package/clamp.js CHANGED
@@ -1,14 +1,27 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.clamp = void 0;
4
1
  /**
5
2
  * Returns a number whose value is limited to the given range.
6
3
  *
7
4
  * @category math
8
5
  * @see https://stackoverflow.com/a/11409944/1938970
9
- */
6
+ */ "use strict";
7
+ Object.defineProperty(exports, "__esModule", {
8
+ value: true
9
+ });
10
+ function _export(target, all) {
11
+ for(var name in all)Object.defineProperty(target, name, {
12
+ enumerable: true,
13
+ get: all[name]
14
+ });
15
+ }
16
+ _export(exports, {
17
+ clamp: function() {
18
+ return clamp;
19
+ },
20
+ default: function() {
21
+ return _default;
22
+ }
23
+ });
10
24
  function clamp(num, min, max) {
11
25
  return Math.min(Math.max(num, min), max);
12
26
  }
13
- exports.clamp = clamp;
14
- exports.default = clamp;
27
+ const _default = clamp;
package/clamp.mjs CHANGED
@@ -3,8 +3,7 @@
3
3
  *
4
4
  * @category math
5
5
  * @see https://stackoverflow.com/a/11409944/1938970
6
- */
7
- export function clamp(num, min, max) {
6
+ */ export function clamp(num, min, max) {
8
7
  return Math.min(Math.max(num, min), max);
9
8
  }
10
9
  export default clamp;
package/clsx.js CHANGED
@@ -1,26 +1,39 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.clsx = void 0;
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
+ clsx: function() {
13
+ return clsx;
14
+ },
15
+ default: function() {
16
+ return _default;
17
+ }
18
+ });
4
19
  // import _clsx from "clsx";
5
20
  // export const clsx = _clsx;
6
21
  function toVal(mix) {
7
- var k, y, str = "";
22
+ let k, y, str = "";
8
23
  if (typeof mix === "string" || typeof mix === "number") {
9
24
  str += mix;
10
- }
11
- else if (typeof mix === "object") {
25
+ } else if (typeof mix === "object") {
12
26
  if (Array.isArray(mix)) {
13
- for (k = 0; k < mix.length; k++) {
27
+ for(k = 0; k < mix.length; k++){
14
28
  if (mix[k]) {
15
- if ((y = toVal(mix[k]))) {
29
+ if (y = toVal(mix[k])) {
16
30
  str && (str += " ");
17
31
  str += y;
18
32
  }
19
33
  }
20
34
  }
21
- }
22
- else {
23
- for (k in mix) {
35
+ } else {
36
+ for(k in mix){
24
37
  if (mix[k]) {
25
38
  str && (str += " ");
26
39
  str += k;
@@ -30,18 +43,12 @@ function toVal(mix) {
30
43
  }
31
44
  return str;
32
45
  }
33
- /**
34
- * Class names utility
35
- *
36
- * @borrows [lukeed/clsx](https://github.com/lukeed/clsx)
37
- * @license [MIT: Luke Edwards](https://github.com/lukeed/clsx/blob/master/license)
38
- */
39
- var clsx = function () {
40
- var i = 0, tmp, x, str = "";
41
- while (i < arguments.length) {
46
+ const clsx = function() {
47
+ let i = 0, tmp, x, str = "";
48
+ while(i < arguments.length){
42
49
  // eslint-disable-next-line prefer-rest-params
43
- if ((tmp = arguments[i++])) {
44
- if ((x = toVal(tmp))) {
50
+ if (tmp = arguments[i++]) {
51
+ if (x = toVal(tmp)) {
45
52
  str && (str += " ");
46
53
  str += x;
47
54
  }
@@ -49,5 +56,4 @@ var clsx = function () {
49
56
  }
50
57
  return str;
51
58
  };
52
- exports.clsx = clsx;
53
- exports.default = exports.clsx;
59
+ const _default = clsx;
package/clsx.mjs CHANGED
@@ -1,23 +1,21 @@
1
1
  // import _clsx from "clsx";
2
2
  // export const clsx = _clsx;
3
3
  function toVal(mix) {
4
- var k, y, str = "";
4
+ let k, y, str = "";
5
5
  if (typeof mix === "string" || typeof mix === "number") {
6
6
  str += mix;
7
- }
8
- else if (typeof mix === "object") {
7
+ } else if (typeof mix === "object") {
9
8
  if (Array.isArray(mix)) {
10
- for (k = 0; k < mix.length; k++) {
9
+ for(k = 0; k < mix.length; k++){
11
10
  if (mix[k]) {
12
- if ((y = toVal(mix[k]))) {
11
+ if (y = toVal(mix[k])) {
13
12
  str && (str += " ");
14
13
  str += y;
15
14
  }
16
15
  }
17
16
  }
18
- }
19
- else {
20
- for (k in mix) {
17
+ } else {
18
+ for(k in mix){
21
19
  if (mix[k]) {
22
20
  str && (str += " ");
23
21
  str += k;
@@ -32,13 +30,12 @@ function toVal(mix) {
32
30
  *
33
31
  * @borrows [lukeed/clsx](https://github.com/lukeed/clsx)
34
32
  * @license [MIT: Luke Edwards](https://github.com/lukeed/clsx/blob/master/license)
35
- */
36
- export var clsx = function () {
37
- var i = 0, tmp, x, str = "";
38
- while (i < arguments.length) {
33
+ */ export const clsx = function() {
34
+ let i = 0, tmp, x, str = "";
35
+ while(i < arguments.length){
39
36
  // eslint-disable-next-line prefer-rest-params
40
- if ((tmp = arguments[i++])) {
41
- if ((x = toVal(tmp))) {
37
+ if (tmp = arguments[i++]) {
38
+ if (x = toVal(tmp)) {
42
39
  str && (str += " ");
43
40
  str += x;
44
41
  }
package/convertRange.js CHANGED
@@ -1,6 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.convertRange = void 0;
4
1
  /**
5
2
  * Convert range of a number
6
3
  *
@@ -12,9 +9,25 @@ exports.convertRange = void 0;
12
9
  *
13
10
  * @category math
14
11
  * @see https://stackoverflow.com/a/14224813
15
- */
12
+ */ "use strict";
13
+ Object.defineProperty(exports, "__esModule", {
14
+ value: true
15
+ });
16
+ function _export(target, all) {
17
+ for(var name in all)Object.defineProperty(target, name, {
18
+ enumerable: true,
19
+ get: all[name]
20
+ });
21
+ }
22
+ _export(exports, {
23
+ convertRange: function() {
24
+ return convertRange;
25
+ },
26
+ default: function() {
27
+ return _default;
28
+ }
29
+ });
16
30
  function convertRange(num, r1, r2) {
17
- return ((num - r1[0]) * (r2[1] - r2[0])) / (r1[1] - r1[0]) + r2[0];
31
+ return (num - r1[0]) * (r2[1] - r2[0]) / (r1[1] - r1[0]) + r2[0];
18
32
  }
19
- exports.convertRange = convertRange;
20
- exports.default = convertRange;
33
+ const _default = convertRange;
package/convertRange.mjs CHANGED
@@ -9,8 +9,7 @@
9
9
  *
10
10
  * @category math
11
11
  * @see https://stackoverflow.com/a/14224813
12
- */
13
- export function convertRange(num, r1, r2) {
14
- return ((num - r1[0]) * (r2[1] - r2[0])) / (r1[1] - r1[0]) + r2[0];
12
+ */ export function convertRange(num, r1, r2) {
13
+ return (num - r1[0]) * (r2[1] - r2[0]) / (r1[1] - r1[0]) + r2[0];
15
14
  }
16
15
  export default convertRange;
package/cookie.js CHANGED
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  /**
3
2
  * @file
4
3
  *
@@ -7,7 +6,16 @@
7
6
  * All cookie related code is inspired and adapted from:
8
7
  * - [js-cookie](https://github.com/js-cookie/js-cookie)
9
8
  * - [cookie](https://github.com/jshttp/cookie)
10
- */
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.defaultAttributesClient = void 0;
13
- exports.defaultAttributesClient = { path: "/" };
9
+ */ "use strict";
10
+ Object.defineProperty(exports, "__esModule", {
11
+ value: true
12
+ });
13
+ Object.defineProperty(exports, "defaultAttributesClient", {
14
+ enumerable: true,
15
+ get: function() {
16
+ return defaultAttributesClient;
17
+ }
18
+ });
19
+ const defaultAttributesClient = {
20
+ path: "/"
21
+ };
package/cookie.mjs CHANGED
@@ -6,5 +6,6 @@
6
6
  * All cookie related code is inspired and adapted from:
7
7
  * - [js-cookie](https://github.com/js-cookie/js-cookie)
8
8
  * - [cookie](https://github.com/jshttp/cookie)
9
- */
10
- export var defaultAttributesClient = { path: "/" };
9
+ */ export const defaultAttributesClient = {
10
+ path: "/"
11
+ };
package/createPalette.js CHANGED
@@ -1,26 +1,34 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createPalette = void 0;
4
- /**
5
- * Create palette, this is primarily thought to improve the reuse of a palette
6
- * definition between TailwindCSS and straight ES imports
7
- *
8
- * @category styling|tailwind|colours
9
- *
10
- * @returns An array with: 1) A flat palette map 2) A TailwindCSS ready palette
11
- * object 3) A flat array of colors (no special sorting, same order as the `shades`
12
- * given as argument)
13
- */
14
- var createPalette = function (name, shades) {
15
- var map = shades.reduce(function (map, def) {
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
+ createPalette: function() {
13
+ return createPalette;
14
+ },
15
+ default: function() {
16
+ return _default;
17
+ }
18
+ });
19
+ const createPalette = (name, shades)=>{
20
+ const map = shades.reduce((map, def)=>{
16
21
  map[def[0]] = def[1];
17
22
  return map;
18
23
  }, {});
19
- var tailwindPalette = shades.reduce(function (map, def) {
20
- map["".concat(name, "-").concat(def[0])] = def[1];
24
+ const tailwindPalette = shades.reduce((map, def)=>{
25
+ map[`${name}-${def[0]}`] = def[1];
21
26
  return map;
22
27
  }, {});
23
- return [map, tailwindPalette, Object.values(map)];
28
+ return [
29
+ map,
30
+ tailwindPalette,
31
+ Object.values(map)
32
+ ];
24
33
  };
25
- exports.createPalette = createPalette;
26
- exports.default = exports.createPalette;
34
+ const _default = createPalette;
package/createPalette.mjs CHANGED
@@ -7,16 +7,19 @@
7
7
  * @returns An array with: 1) A flat palette map 2) A TailwindCSS ready palette
8
8
  * object 3) A flat array of colors (no special sorting, same order as the `shades`
9
9
  * given as argument)
10
- */
11
- export var createPalette = function (name, shades) {
12
- var map = shades.reduce(function (map, def) {
10
+ */ export const createPalette = (name, shades)=>{
11
+ const map = shades.reduce((map, def)=>{
13
12
  map[def[0]] = def[1];
14
13
  return map;
15
14
  }, {});
16
- var tailwindPalette = shades.reduce(function (map, def) {
17
- map["".concat(name, "-").concat(def[0])] = def[1];
15
+ const tailwindPalette = shades.reduce((map, def)=>{
16
+ map[`${name}-${def[0]}`] = def[1];
18
17
  return map;
19
18
  }, {});
20
- return [map, tailwindPalette, Object.values(map)];
19
+ return [
20
+ map,
21
+ tailwindPalette,
22
+ Object.values(map)
23
+ ];
21
24
  };
22
25
  export default createPalette;
package/debounce.js CHANGED
@@ -1,33 +1,39 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.debounce = void 0;
4
1
  /**
5
2
  * Debounce function (with `setTimeout`)
6
3
  *
7
4
  * @category function
8
5
  * @borrows [davidwalsh/debounce](https://davidwalsh.name/javascript-debounce-function)
9
- */
6
+ */ "use strict";
7
+ Object.defineProperty(exports, "__esModule", {
8
+ value: true
9
+ });
10
+ function _export(target, all) {
11
+ for(var name in all)Object.defineProperty(target, name, {
12
+ enumerable: true,
13
+ get: all[name]
14
+ });
15
+ }
16
+ _export(exports, {
17
+ debounce: function() {
18
+ return debounce;
19
+ },
20
+ default: function() {
21
+ return _default;
22
+ }
23
+ });
10
24
  function debounce(fn, wait, immediate) {
11
- var timeout;
12
- return function () {
13
- var args = [];
14
- for (var _i = 0; _i < arguments.length; _i++) {
15
- args[_i] = arguments[_i];
16
- }
25
+ let timeout;
26
+ return function(...args) {
17
27
  // eslint-disable-next-line @typescript-eslint/no-this-alias
18
- var context = this;
19
- var later = function () {
28
+ const context = this;
29
+ const later = function() {
20
30
  timeout = null;
21
- if (!immediate)
22
- fn.apply(context, args);
31
+ if (!immediate) fn.apply(context, args);
23
32
  };
24
- var callNow = immediate && !timeout;
25
- if (timeout)
26
- clearTimeout(timeout);
33
+ const callNow = immediate && !timeout;
34
+ if (timeout) clearTimeout(timeout);
27
35
  timeout = setTimeout(later, wait);
28
- if (callNow)
29
- fn.apply(context, args);
36
+ if (callNow) fn.apply(context, args);
30
37
  };
31
38
  }
32
- exports.debounce = debounce;
33
- exports.default = debounce;
39
+ const _default = debounce;
package/debounce.mjs CHANGED
@@ -3,27 +3,19 @@
3
3
  *
4
4
  * @category function
5
5
  * @borrows [davidwalsh/debounce](https://davidwalsh.name/javascript-debounce-function)
6
- */
7
- export function debounce(fn, wait, immediate) {
8
- var timeout;
9
- return function () {
10
- var args = [];
11
- for (var _i = 0; _i < arguments.length; _i++) {
12
- args[_i] = arguments[_i];
13
- }
6
+ */ export function debounce(fn, wait, immediate) {
7
+ let timeout;
8
+ return function(...args) {
14
9
  // eslint-disable-next-line @typescript-eslint/no-this-alias
15
- var context = this;
16
- var later = function () {
10
+ const context = this;
11
+ const later = function() {
17
12
  timeout = null;
18
- if (!immediate)
19
- fn.apply(context, args);
13
+ if (!immediate) fn.apply(context, args);
20
14
  };
21
- var callNow = immediate && !timeout;
22
- if (timeout)
23
- clearTimeout(timeout);
15
+ const callNow = immediate && !timeout;
16
+ if (timeout) clearTimeout(timeout);
24
17
  timeout = setTimeout(later, wait);
25
- if (callNow)
26
- fn.apply(context, args);
18
+ if (callNow) fn.apply(context, args);
27
19
  };
28
20
  }
29
21
  export default debounce;
@@ -1,12 +1,21 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.debouncePromise = void 0;
4
- var ts_debounce_1 = require("ts-debounce");
5
- /**
6
- * Debounce function (with `Promise`)
7
- *
8
- * @category function
9
- * @borrows [chodorowicz/ts-debounce](https://github.com/chodorowicz/ts-debounce)
10
- */
11
- exports.debouncePromise = ts_debounce_1.debounce;
12
- exports.default = exports.debouncePromise;
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
+ debouncePromise: function() {
13
+ return debouncePromise;
14
+ },
15
+ default: function() {
16
+ return _default;
17
+ }
18
+ });
19
+ const _tsdebounce = require("ts-debounce");
20
+ const debouncePromise = _tsdebounce.debounce;
21
+ const _default = debouncePromise;
@@ -4,6 +4,5 @@ import { debounce as tsDebounce } from "ts-debounce";
4
4
  *
5
5
  * @category function
6
6
  * @borrows [chodorowicz/ts-debounce](https://github.com/chodorowicz/ts-debounce)
7
- */
8
- export var debouncePromise = tsDebounce;
7
+ */ export const debouncePromise = tsDebounce;
9
8
  export default debouncePromise;
package/debounceRaf.js CHANGED
@@ -1,31 +1,40 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.debounceRaf = void 0;
4
1
  /**
5
2
  * Debounce function (with `requestAnimationFrame`)
6
3
  *
7
4
  * (c) 2021 Chris Ferdinandi, MIT License, https://gomakethings.com
8
5
  * @category function
9
6
  * @borrows [vanillajstoolkit/debounce](https://vanillajstoolkit.com/helpers/debounce/)
10
- */
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
+ debounceRaf: function() {
19
+ return debounceRaf;
20
+ },
21
+ default: function() {
22
+ return _default;
23
+ }
24
+ });
11
25
  function debounceRaf(fn) {
12
- var timeout;
13
- return function () {
14
- var args = [];
15
- for (var _i = 0; _i < arguments.length; _i++) {
16
- args[_i] = arguments[_i];
17
- }
26
+ let timeout;
27
+ return function(...args) {
18
28
  // eslint-disable-next-line @typescript-eslint/no-this-alias
19
- var context = this;
29
+ const context = this;
20
30
  // If there's a timer, cancel it
21
31
  if (timeout) {
22
32
  window.cancelAnimationFrame(timeout);
23
33
  }
24
34
  // Setup the new requestAnimationFrame()
25
- timeout = window.requestAnimationFrame(function () {
35
+ timeout = window.requestAnimationFrame(function() {
26
36
  fn.apply(context, args);
27
37
  });
28
38
  };
29
39
  }
30
- exports.debounceRaf = debounceRaf;
31
- exports.default = debounceRaf;
40
+ const _default = debounceRaf;