@koine/utils 2.0.0-beta.1 → 2.0.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Defer.js +23 -18
- package/Defer.mjs +6 -5
- package/Emitter.js +31 -20
- package/Emitter.mjs +13 -16
- package/README.md +6 -1
- package/accentSets.js +129 -37
- package/accentSets.mjs +113 -29
- package/addOrReplaceAtIdx.js +27 -10
- package/addOrReplaceAtIdx.mjs +9 -6
- package/areEqual.js +35 -41
- package/areEqual.mjs +16 -22
- package/arrayOfAll.js +20 -11
- package/arrayOfAll.mjs +1 -6
- package/arraySum.js +20 -9
- package/arraySum.mjs +1 -4
- package/arrayToLookup.js +21 -9
- package/arrayToLookup.mjs +2 -4
- package/buildUrlQueryString.js +32 -29
- package/buildUrlQueryString.mjs +11 -14
- package/capitalize.js +21 -9
- package/capitalize.mjs +3 -5
- package/changeUrlPath.js +23 -17
- package/changeUrlPath.mjs +2 -3
- package/chunkByChunks.js +35 -24
- package/chunkByChunks.mjs +17 -20
- package/chunkBySize.js +21 -8
- package/chunkBySize.mjs +3 -4
- package/clamp.js +19 -6
- package/clamp.mjs +1 -2
- package/clsx.d.ts +4 -1
- package/clsx.js +30 -23
- package/clsx.mjs +12 -14
- package/convertRange.js +20 -7
- package/convertRange.mjs +2 -3
- package/cookie.js +13 -5
- package/cookie.mjs +3 -2
- package/createPalette.js +32 -19
- package/createPalette.mjs +14 -6
- package/debounce.js +27 -21
- package/debounce.mjs +9 -17
- package/debouncePromise.d.ts +14 -4
- package/debouncePromise.js +86 -11
- package/debouncePromise.mjs +69 -3
- package/debounceRaf.js +23 -14
- package/debounceRaf.mjs +5 -10
- package/decode.js +20 -7
- package/decode.mjs +2 -3
- package/encode.js +20 -7
- package/encode.mjs +2 -3
- package/ensureInt.js +20 -9
- package/ensureInt.mjs +1 -4
- package/env.js +1 -1
- package/env.mjs +0 -1
- package/errorToString.js +21 -14
- package/errorToString.mjs +1 -4
- package/findDuplicatedIndexes.js +22 -9
- package/findDuplicatedIndexes.mjs +4 -5
- package/forin.js +20 -7
- package/forin.mjs +2 -3
- package/gbToBytes.js +20 -7
- package/gbToBytes.mjs +1 -2
- package/getEmptyArray.js +25 -16
- package/getEmptyArray.mjs +4 -3
- package/getKeys.js +20 -6
- package/getKeys.mjs +1 -2
- package/getMediaQueryWidthResolvers.js +62 -53
- package/getMediaQueryWidthResolvers.mjs +44 -49
- package/getMediaQueryWidthTailwindScreens.js +36 -18
- package/getMediaQueryWidthTailwindScreens.mjs +18 -14
- package/getNonce.js +20 -10
- package/getNonce.mjs +1 -2
- package/getParamAmong.js +22 -19
- package/getParamAmong.mjs +2 -4
- package/getParamAsInt.js +22 -19
- package/getParamAsInt.mjs +2 -4
- package/getParamAsString.js +21 -16
- package/getParamAsString.mjs +1 -2
- package/getType.js +19 -12
- package/getType.mjs +2 -4
- package/getUrlHashParams.js +20 -13
- package/getUrlHashParams.mjs +2 -4
- package/getUrlHashPathname.js +20 -8
- package/getUrlHashPathname.mjs +1 -3
- package/getUrlPathnameParts.js +23 -23
- package/getUrlPathnameParts.mjs +2 -7
- package/getUrlQueryParams.js +26 -33
- package/getUrlQueryParams.mjs +7 -18
- package/imgEmptyPixel.js +20 -6
- package/imgEmptyPixel.mjs +1 -2
- package/index.d.ts +1 -1
- package/index.js +531 -266
- package/index.mjs +2 -2
- package/invariant.js +24 -12
- package/invariant.mjs +6 -8
- package/isAnyObject.js +21 -12
- package/isAnyObject.mjs +1 -2
- package/isArray.js +21 -12
- package/isArray.mjs +1 -2
- package/isBlob.js +21 -12
- package/isBlob.mjs +1 -2
- package/isBoolean.js +21 -12
- package/isBoolean.mjs +1 -2
- package/isBrowser.js +20 -6
- package/isBrowser.mjs +1 -2
- package/isBrowserNow.js +21 -11
- package/isBrowserNow.mjs +1 -2
- package/isDate.js +21 -12
- package/isDate.mjs +1 -2
- package/isEmptyArray.js +21 -12
- package/isEmptyArray.mjs +1 -2
- package/isEmptyObject.js +21 -12
- package/isEmptyObject.mjs +1 -2
- package/isEmptyString.js +19 -6
- package/isEmptyString.mjs +1 -2
- package/isError.js +21 -12
- package/isError.mjs +1 -2
- package/isExternalUrl.js +24 -18
- package/isExternalUrl.mjs +4 -6
- package/isFile.js +21 -12
- package/isFile.mjs +1 -2
- package/isFloat.js +21 -12
- package/isFloat.mjs +1 -2
- package/isFormData.js +21 -12
- package/isFormData.mjs +1 -2
- package/isFullArray.js +21 -12
- package/isFullArray.mjs +1 -2
- package/isFullObject.js +21 -12
- package/isFullObject.mjs +1 -2
- package/isFullString.js +21 -12
- package/isFullString.mjs +1 -2
- package/isFunction.js +18 -9
- package/isFunction.mjs +1 -2
- package/isInt.js +21 -12
- package/isInt.mjs +1 -2
- package/isMap.js +21 -12
- package/isMap.mjs +1 -2
- package/isNaNValue.js +21 -12
- package/isNaNValue.mjs +1 -2
- package/isNegativeNumber.js +21 -12
- package/isNegativeNumber.mjs +1 -2
- package/isNull.js +21 -12
- package/isNull.mjs +1 -2
- package/isNullOrUndefined.js +23 -13
- package/isNullOrUndefined.mjs +1 -2
- package/isNumber.js +21 -14
- package/isNumber.mjs +1 -2
- package/isObject.js +21 -12
- package/isObject.mjs +1 -2
- package/isObjectLike.js +21 -14
- package/isObjectLike.mjs +1 -2
- package/isOneOf.js +19 -11
- package/isOneOf.mjs +1 -7
- package/isPlainObject.js +22 -15
- package/isPlainObject.mjs +3 -6
- package/isPositiveNumber.js +21 -12
- package/isPositiveNumber.mjs +1 -2
- package/isPrimitive.js +26 -22
- package/isPrimitive.mjs +5 -11
- package/isPromise.js +21 -12
- package/isPromise.mjs +1 -2
- package/isRegExp.js +21 -12
- package/isRegExp.mjs +1 -2
- package/isServer.js +22 -11
- package/isServer.mjs +1 -2
- package/isServerNow.js +21 -11
- package/isServerNow.mjs +1 -2
- package/isSet.js +21 -12
- package/isSet.mjs +1 -2
- package/isString.js +21 -12
- package/isString.mjs +1 -2
- package/isSymbol.js +21 -12
- package/isSymbol.mjs +1 -2
- package/isType.js +22 -17
- package/isType.mjs +3 -5
- package/isUndefined.js +21 -12
- package/isUndefined.mjs +1 -2
- package/isWeakMap.js +21 -12
- package/isWeakMap.mjs +1 -2
- package/isWeakSet.js +21 -12
- package/isWeakSet.mjs +1 -2
- package/kbToBytes.js +20 -7
- package/kbToBytes.mjs +1 -2
- package/location.js +6 -2
- package/location.mjs +3 -1
- package/lowercase.js +20 -9
- package/lowercase.mjs +1 -4
- package/mapListBy.js +21 -10
- package/mapListBy.mjs +2 -5
- package/matchSorter.js +132 -133
- package/matchSorter.mjs +108 -126
- package/mbToBytes.js +20 -7
- package/mbToBytes.mjs +1 -2
- package/mergeObjects.d.ts +1 -1
- package/mergeObjects.js +24 -26
- package/mergeObjects.mjs +12 -15
- package/mergeUrlQueryParams.js +25 -20
- package/mergeUrlQueryParams.mjs +4 -8
- package/moveSortableArrayItemByKey.js +26 -12
- package/moveSortableArrayItemByKey.mjs +8 -8
- package/noop.js +20 -7
- package/noop.mjs +1 -2
- package/normaliseUrl.js +22 -18
- package/normaliseUrl.mjs +1 -3
- package/normaliseUrlPathname.js +22 -17
- package/normaliseUrlPathname.mjs +1 -3
- package/objectOmit.js +21 -9
- package/objectOmit.mjs +3 -5
- package/objectPick.js +22 -9
- package/objectPick.mjs +4 -5
- package/package.json +7 -11
- package/parseCookie.js +29 -26
- package/parseCookie.mjs +11 -15
- package/parseURL.js +23 -10
- package/parseURL.mjs +5 -6
- package/quaranteneProps.js +24 -12
- package/quaranteneProps.mjs +6 -8
- package/randomInt.js +19 -6
- package/randomInt.mjs +1 -2
- package/randomKey.js +21 -8
- package/randomKey.mjs +3 -4
- package/readCookie.js +25 -12
- package/readCookie.mjs +7 -8
- package/removeAccents.js +24 -15
- package/removeAccents.mjs +5 -8
- package/removeCookie.js +26 -17
- package/removeCookie.mjs +6 -5
- package/removeDuplicates.js +1 -1
- package/removeDuplicates.mjs +0 -1
- package/removeDuplicatesByKey.js +24 -12
- package/removeDuplicatesByKey.mjs +5 -7
- package/removeDuplicatesComparing.js +22 -11
- package/removeDuplicatesComparing.mjs +3 -4
- package/removeIndexesFromArray.js +21 -8
- package/removeIndexesFromArray.mjs +3 -4
- package/removeTrailingSlash.js +20 -8
- package/removeTrailingSlash.mjs +1 -3
- package/removeUrlQueryParams.js +27 -20
- package/removeUrlQueryParams.mjs +5 -7
- package/render.js +61 -137
- package/render.mjs +43 -98
- package/roundTo.js +34 -22
- package/roundTo.mjs +15 -17
- package/serializeCookie.js +29 -35
- package/serializeCookie.mjs +9 -15
- package/setCookie.js +37 -31
- package/setCookie.mjs +13 -16
- package/shuffle.js +28 -14
- package/shuffle.mjs +10 -10
- package/slugify.js +33 -25
- package/slugify.mjs +13 -11
- package/split.js +18 -4
- package/swapMap.js +22 -10
- package/swapMap.mjs +3 -5
- package/throttle.d.ts +1 -0
- package/throttle.js +23 -15
- package/throttle.mjs +5 -11
- package/titleCase.js +20 -11
- package/titleCase.mjs +1 -6
- package/toNumber.js +20 -9
- package/toNumber.mjs +1 -2
- package/toRgba.js +22 -10
- package/toRgba.mjs +3 -5
- package/transformToUrlPathname.js +21 -18
- package/transformToUrlPathname.mjs +2 -5
- package/truncate.js +20 -13
- package/truncate.mjs +1 -8
- package/tryUntil.js +26 -15
- package/tryUntil.mjs +7 -10
- package/types.js +4 -1
- package/types.mjs +2 -1
- package/uid.js +21 -13
- package/uid.mjs +3 -5
- package/updateLinkParams.js +21 -14
- package/updateLinkParams.mjs +2 -3
- package/updateUrlQueryParams.js +26 -21
- package/updateUrlQueryParams.mjs +3 -7
- package/uppercase.js +20 -9
- package/uppercase.mjs +1 -4
- package/uuid.js +21 -10
- package/uuid.mjs +2 -5
- package/uuidNumeric.js +20 -7
- package/uuidNumeric.mjs +1 -2
- package/wait.js +20 -9
- package/wait.mjs +1 -4
- package/without.js +2 -3
- 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
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
|
16
|
-
output.push(arr.slice(i,
|
|
15
|
+
while(i < len){
|
|
16
|
+
output.push(arr.slice(i, i += size));
|
|
17
17
|
}
|
|
18
|
-
}
|
|
19
|
-
|
|
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,
|
|
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
|
-
|
|
30
|
-
|
|
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
|
-
|
|
10
|
-
for
|
|
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
|
-
|
|
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
|
-
|
|
6
|
-
|
|
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
|
-
|
|
14
|
-
exports.default = clamp;
|
|
27
|
+
const _default = clamp;
|
package/clamp.mjs
CHANGED
package/clsx.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
type ClassValue = ClassArray | ClassDictionary | string | number | null | boolean | undefined;
|
|
2
|
+
type ClassDictionary = Record<string, any>;
|
|
3
|
+
type ClassArray = ClassValue[];
|
|
4
|
+
export type ClsxClassValue = ClassValue;
|
|
2
5
|
/**
|
|
3
6
|
* Class names utility
|
|
4
7
|
*
|
package/clsx.js
CHANGED
|
@@ -1,26 +1,40 @@
|
|
|
1
|
+
// import type { ClassValue } from "clsx";
|
|
1
2
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
function _export(target, all) {
|
|
7
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: all[name]
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
_export(exports, {
|
|
13
|
+
clsx: function() {
|
|
14
|
+
return clsx;
|
|
15
|
+
},
|
|
16
|
+
default: function() {
|
|
17
|
+
return _default;
|
|
18
|
+
}
|
|
19
|
+
});
|
|
4
20
|
// import _clsx from "clsx";
|
|
5
21
|
// export const clsx = _clsx;
|
|
6
22
|
function toVal(mix) {
|
|
7
|
-
|
|
23
|
+
let k, y, str = "";
|
|
8
24
|
if (typeof mix === "string" || typeof mix === "number") {
|
|
9
25
|
str += mix;
|
|
10
|
-
}
|
|
11
|
-
else if (typeof mix === "object") {
|
|
26
|
+
} else if (typeof mix === "object") {
|
|
12
27
|
if (Array.isArray(mix)) {
|
|
13
|
-
for
|
|
28
|
+
for(k = 0; k < mix.length; k++){
|
|
14
29
|
if (mix[k]) {
|
|
15
|
-
if (
|
|
30
|
+
if (y = toVal(mix[k])) {
|
|
16
31
|
str && (str += " ");
|
|
17
32
|
str += y;
|
|
18
33
|
}
|
|
19
34
|
}
|
|
20
35
|
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
for (k in mix) {
|
|
36
|
+
} else {
|
|
37
|
+
for(k in mix){
|
|
24
38
|
if (mix[k]) {
|
|
25
39
|
str && (str += " ");
|
|
26
40
|
str += k;
|
|
@@ -30,18 +44,12 @@ function toVal(mix) {
|
|
|
30
44
|
}
|
|
31
45
|
return str;
|
|
32
46
|
}
|
|
33
|
-
|
|
34
|
-
|
|
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) {
|
|
47
|
+
const clsx = function() {
|
|
48
|
+
let i = 0, tmp, x, str = "";
|
|
49
|
+
while(i < arguments.length){
|
|
42
50
|
// eslint-disable-next-line prefer-rest-params
|
|
43
|
-
if (
|
|
44
|
-
if (
|
|
51
|
+
if (tmp = arguments[i++]) {
|
|
52
|
+
if (x = toVal(tmp)) {
|
|
45
53
|
str && (str += " ");
|
|
46
54
|
str += x;
|
|
47
55
|
}
|
|
@@ -49,5 +57,4 @@ var clsx = function () {
|
|
|
49
57
|
}
|
|
50
58
|
return str;
|
|
51
59
|
};
|
|
52
|
-
|
|
53
|
-
exports.default = exports.clsx;
|
|
60
|
+
const _default = clsx;
|
package/clsx.mjs
CHANGED
|
@@ -1,23 +1,22 @@
|
|
|
1
|
+
// import type { ClassValue } from "clsx";
|
|
1
2
|
// import _clsx from "clsx";
|
|
2
3
|
// export const clsx = _clsx;
|
|
3
4
|
function toVal(mix) {
|
|
4
|
-
|
|
5
|
+
let k, y, str = "";
|
|
5
6
|
if (typeof mix === "string" || typeof mix === "number") {
|
|
6
7
|
str += mix;
|
|
7
|
-
}
|
|
8
|
-
else if (typeof mix === "object") {
|
|
8
|
+
} else if (typeof mix === "object") {
|
|
9
9
|
if (Array.isArray(mix)) {
|
|
10
|
-
for
|
|
10
|
+
for(k = 0; k < mix.length; k++){
|
|
11
11
|
if (mix[k]) {
|
|
12
|
-
if (
|
|
12
|
+
if (y = toVal(mix[k])) {
|
|
13
13
|
str && (str += " ");
|
|
14
14
|
str += y;
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
for (k in mix) {
|
|
18
|
+
} else {
|
|
19
|
+
for(k in mix){
|
|
21
20
|
if (mix[k]) {
|
|
22
21
|
str && (str += " ");
|
|
23
22
|
str += k;
|
|
@@ -32,13 +31,12 @@ function toVal(mix) {
|
|
|
32
31
|
*
|
|
33
32
|
* @borrows [lukeed/clsx](https://github.com/lukeed/clsx)
|
|
34
33
|
* @license [MIT: Luke Edwards](https://github.com/lukeed/clsx/blob/master/license)
|
|
35
|
-
*/
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
while (i < arguments.length) {
|
|
34
|
+
*/ export const clsx = function() {
|
|
35
|
+
let i = 0, tmp, x, str = "";
|
|
36
|
+
while(i < arguments.length){
|
|
39
37
|
// eslint-disable-next-line prefer-rest-params
|
|
40
|
-
if (
|
|
41
|
-
if (
|
|
38
|
+
if (tmp = arguments[i++]) {
|
|
39
|
+
if (x = toVal(tmp)) {
|
|
42
40
|
str && (str += " ");
|
|
43
41
|
str += x;
|
|
44
42
|
}
|
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 (
|
|
31
|
+
return (num - r1[0]) * (r2[1] - r2[0]) / (r1[1] - r1[0]) + r2[0];
|
|
18
32
|
}
|
|
19
|
-
|
|
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
|
-
|
|
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", {
|
|
12
|
-
|
|
13
|
-
|
|
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
|
-
|
|
9
|
+
*/ export const defaultAttributesClient = {
|
|
10
|
+
path: "/"
|
|
11
|
+
};
|
package/createPalette.js
CHANGED
|
@@ -1,26 +1,39 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
-
|
|
20
|
-
|
|
24
|
+
// NOTE: the following breaks typedoc, with `any` it compiles
|
|
25
|
+
// const map = shades.reduce((map, def) => {
|
|
26
|
+
// map[def[0]] = def[1] as TColor;
|
|
27
|
+
// return map;
|
|
28
|
+
// }, {} as { [s: string]: TColor });
|
|
29
|
+
const tailwindPalette = shades.reduce((map, def)=>{
|
|
30
|
+
map[`${name}-${def[0]}`] = def[1];
|
|
21
31
|
return map;
|
|
22
32
|
}, {});
|
|
23
|
-
return [
|
|
33
|
+
return [
|
|
34
|
+
map,
|
|
35
|
+
tailwindPalette,
|
|
36
|
+
Object.values(map)
|
|
37
|
+
];
|
|
24
38
|
};
|
|
25
|
-
|
|
26
|
-
exports.default = exports.createPalette;
|
|
39
|
+
const _default = createPalette;
|
package/createPalette.mjs
CHANGED
|
@@ -7,16 +7,24 @@
|
|
|
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
|
-
|
|
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
|
-
|
|
17
|
-
|
|
15
|
+
// NOTE: the following breaks typedoc, with `any` it compiles
|
|
16
|
+
// const map = shades.reduce((map, def) => {
|
|
17
|
+
// map[def[0]] = def[1] as TColor;
|
|
18
|
+
// return map;
|
|
19
|
+
// }, {} as { [s: string]: TColor });
|
|
20
|
+
const tailwindPalette = shades.reduce((map, def)=>{
|
|
21
|
+
map[`${name}-${def[0]}`] = def[1];
|
|
18
22
|
return map;
|
|
19
23
|
}, {});
|
|
20
|
-
return [
|
|
24
|
+
return [
|
|
25
|
+
map,
|
|
26
|
+
tailwindPalette,
|
|
27
|
+
Object.values(map)
|
|
28
|
+
];
|
|
21
29
|
};
|
|
22
30
|
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
|
-
|
|
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
|
-
|
|
19
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
8
|
-
|
|
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
|
-
|
|
16
|
-
|
|
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
|
-
|
|
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;
|
package/debouncePromise.d.ts
CHANGED
|
@@ -1,11 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @file Copy pasted from https://github.com/chodorowicz/ts-debounce/blob/master/src/index.ts
|
|
3
|
+
*/
|
|
4
|
+
export type DebounceOptions<Result> = {
|
|
5
|
+
isImmediate?: boolean;
|
|
6
|
+
maxWait?: number;
|
|
7
|
+
callback?: (data: Result) => void;
|
|
8
|
+
};
|
|
9
|
+
export interface DebouncedFunction<Args extends any[], F extends (...args: Args) => any> {
|
|
10
|
+
(this: ThisParameterType<F>, ...args: Args & Parameters<F>): Promise<ReturnType<F>>;
|
|
11
|
+
cancel: (reason?: any) => void;
|
|
12
|
+
}
|
|
4
13
|
/**
|
|
5
14
|
* Debounce function (with `Promise`)
|
|
6
15
|
*
|
|
7
16
|
* @category function
|
|
8
17
|
* @borrows [chodorowicz/ts-debounce](https://github.com/chodorowicz/ts-debounce)
|
|
18
|
+
* @license [MIT: Jakub Chodorowicz](Jakub Chodorowicz)
|
|
9
19
|
*/
|
|
10
|
-
export declare
|
|
20
|
+
export declare function debouncePromise<Args extends any[], F extends (...args: Args) => any>(func: F, waitMilliseconds?: number, options?: DebounceOptions<ReturnType<F>>): DebouncedFunction<Args, F>;
|
|
11
21
|
export default debouncePromise;
|