@koine/utils 1.1.10 → 1.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Defer.js +6 -2
- package/{node/Defer.js → Defer.mjs} +2 -6
- package/Emitter.js +6 -2
- package/{node/Emitter.js → Emitter.mjs} +2 -6
- package/accentSets.js +5 -2
- package/{node/accentSets.js → accentSets.mjs} +2 -5
- package/addOrReplaceAtIdx.js +8 -4
- package/addOrReplaceAtIdx.mjs +19 -0
- package/areEqual.js +10 -6
- package/{node/areEqual.js → areEqual.mjs} +6 -10
- package/arrayOfAll.js +6 -2
- package/{node/arrayOfAll.js → arrayOfAll.mjs} +2 -6
- package/arraySum.js +6 -2
- package/arraySum.mjs +9 -0
- package/arrayToLookup.js +6 -2
- package/{node/arrayToLookup.js → arrayToLookup.mjs} +2 -6
- package/buildUrlQueryString.js +12 -7
- package/{node/buildUrlQueryString.js → buildUrlQueryString.mjs} +7 -12
- package/capitalize.js +6 -2
- package/{node/capitalize.js → capitalize.mjs} +2 -6
- package/changeUrlPath.js +11 -6
- package/changeUrlPath.mjs +18 -0
- package/chunkByChunks.js +6 -2
- package/{node/chunkByChunks.js → chunkByChunks.mjs} +2 -6
- package/chunkBySize.js +6 -2
- package/{node/chunkBySize.js → chunkBySize.mjs} +2 -6
- package/clamp.js +6 -2
- package/{node/clamp.js → clamp.mjs} +2 -6
- package/clsx.js +6 -2
- package/{node/clsx.js → clsx.mjs} +2 -6
- package/convertRange.js +6 -2
- package/{node/convertRange.js → convertRange.mjs} +2 -6
- package/cookie.js +4 -1
- package/{node/cookie.js → cookie.mjs} +1 -4
- package/debounce.js +6 -2
- package/{node/debounce.js → debounce.mjs} +2 -6
- package/debouncePromise.js +6 -3
- package/debouncePromise.mjs +9 -0
- package/debounceRaf.js +6 -2
- package/{node/debounceRaf.js → debounceRaf.mjs} +2 -6
- package/decode.js +6 -2
- package/{node/decode.js → decode.mjs} +2 -6
- package/encode.js +6 -2
- package/{node/encode.js → encode.mjs} +2 -6
- package/ensureInt.js +6 -2
- package/ensureInt.mjs +9 -0
- package/{node/env.js → env.mjs} +0 -0
- package/findDuplicatedIndexes.js +6 -2
- package/{node/findDuplicatedIndexes.js → findDuplicatedIndexes.mjs} +2 -6
- package/forin.js +6 -2
- package/forin.mjs +11 -0
- package/gbToBytes.js +6 -2
- package/gbToBytes.mjs +7 -0
- package/getEmptyArray.js +9 -4
- package/getEmptyArray.mjs +15 -0
- package/getKeys.js +5 -2
- package/{node/getKeys.js → getKeys.mjs} +2 -5
- package/getMediaQueryWidthResolvers.js +8 -4
- package/{node/getMediaQueryWidthResolvers.js → getMediaQueryWidthResolvers.mjs} +4 -8
- package/getMediaQueryWidthTailwindScreens.js +8 -4
- package/{node/getMediaQueryWidthTailwindScreens.js → getMediaQueryWidthTailwindScreens.mjs} +4 -8
- package/getNonce.js +8 -4
- package/getNonce.mjs +9 -0
- package/getParamAmong.js +9 -4
- package/{node/getParamAmong.js → getParamAmong.mjs} +4 -9
- package/getParamAsInt.js +9 -4
- package/{node/getParamAsInt.js → getParamAsInt.mjs} +4 -9
- package/getParamAsString.js +9 -4
- package/getParamAsString.mjs +14 -0
- package/getType.js +6 -2
- package/{node/getType.js → getType.mjs} +2 -6
- package/getUrlHashParams.js +6 -2
- package/{node/getUrlHashParams.js → getUrlHashParams.mjs} +2 -6
- package/getUrlHashPathname.js +6 -2
- package/{node/getUrlHashPathname.js → getUrlHashPathname.mjs} +2 -6
- package/getUrlPathnameParts.js +9 -4
- package/{node/getUrlPathnameParts.js → getUrlPathnameParts.mjs} +4 -9
- package/getUrlQueryParams.js +9 -4
- package/{node/getUrlQueryParams.js → getUrlQueryParams.mjs} +4 -9
- package/imgEmptyPixel.js +5 -2
- package/imgEmptyPixel.mjs +7 -0
- package/index.js +132 -129
- package/index.mjs +131 -0
- package/invariant.js +6 -2
- package/{node/invariant.js → invariant.mjs} +2 -6
- package/isAnyObject.js +9 -4
- package/isAnyObject.mjs +10 -0
- package/isArray.js +9 -4
- package/isArray.mjs +10 -0
- package/isBlob.js +9 -4
- package/isBlob.mjs +10 -0
- package/isBoolean.js +9 -4
- package/isBoolean.mjs +10 -0
- package/isBrowser.js +5 -2
- package/isBrowser.mjs +8 -0
- package/isDate.js +9 -4
- package/isDate.mjs +10 -0
- package/isEmptyArray.js +9 -4
- package/isEmptyArray.mjs +10 -0
- package/isEmptyObject.js +9 -4
- package/isEmptyObject.mjs +10 -0
- package/isEmptyString.js +6 -2
- package/isEmptyString.mjs +9 -0
- package/isError.js +9 -4
- package/isError.mjs +10 -0
- package/isExternalUrl.js +9 -4
- package/{node/isExternalUrl.js → isExternalUrl.mjs} +4 -9
- package/isFile.js +9 -4
- package/isFile.mjs +10 -0
- package/isFloat.js +9 -4
- package/isFloat.mjs +10 -0
- package/isFormData.js +9 -4
- package/isFormData.mjs +10 -0
- package/isFullArray.js +9 -4
- package/isFullArray.mjs +10 -0
- package/isFullObject.js +9 -4
- package/isFullObject.mjs +10 -0
- package/isFullString.js +9 -4
- package/isFullString.mjs +10 -0
- package/isFunction.js +6 -2
- package/isFunction.mjs +9 -0
- package/isInt.js +9 -4
- package/isInt.mjs +10 -0
- package/isMap.js +9 -4
- package/isMap.mjs +10 -0
- package/isNaNValue.js +9 -4
- package/isNaNValue.mjs +10 -0
- package/isNegativeNumber.js +9 -4
- package/isNegativeNumber.mjs +10 -0
- package/isNull.js +9 -4
- package/isNull.mjs +10 -0
- package/isNullOrUndefined.js +9 -5
- package/isNullOrUndefined.mjs +10 -0
- package/isNumber.js +9 -4
- package/isNumber.mjs +12 -0
- package/isObject.js +9 -4
- package/isObject.mjs +10 -0
- package/isObjectLike.js +9 -4
- package/isObjectLike.mjs +12 -0
- package/isOneOf.js +6 -2
- package/isOneOf.mjs +10 -0
- package/isPlainObject.js +9 -4
- package/isPlainObject.mjs +13 -0
- package/isPositiveNumber.js +9 -4
- package/isPositiveNumber.mjs +10 -0
- package/isPrimitive.js +19 -14
- package/isPrimitive.mjs +20 -0
- package/isPromise.js +9 -4
- package/isPromise.mjs +10 -0
- package/isRegExp.js +9 -4
- package/isRegExp.mjs +10 -0
- package/isServer.js +7 -3
- package/isServer.mjs +9 -0
- package/isSet.js +9 -4
- package/isSet.mjs +10 -0
- package/isString.js +9 -4
- package/isString.mjs +10 -0
- package/isSymbol.js +9 -4
- package/isSymbol.mjs +10 -0
- package/isType.js +9 -4
- package/{node/isType.js → isType.mjs} +4 -9
- package/isUndefined.js +9 -4
- package/isUndefined.mjs +10 -0
- package/isWeakMap.js +9 -4
- package/isWeakMap.mjs +10 -0
- package/isWeakSet.js +9 -4
- package/isWeakSet.mjs +10 -0
- package/kbToBytes.js +6 -2
- package/kbToBytes.mjs +7 -0
- package/location.js +2 -1
- package/location.mjs +1 -0
- package/lowercase.js +6 -2
- package/lowercase.mjs +9 -0
- package/mapListBy.js +6 -2
- package/{node/mapListBy.js → mapListBy.mjs} +2 -6
- package/matchSorter.js +11 -7
- package/{node/matchSorter.js → matchSorter.mjs} +7 -11
- package/mbToBytes.js +6 -2
- package/mbToBytes.mjs +7 -0
- package/mergeObjects.js +11 -7
- package/{node/mergeObjects.js → mergeObjects.mjs} +7 -11
- package/mergeUrlQueryParams.js +9 -4
- package/{node/mergeUrlQueryParams.js → mergeUrlQueryParams.mjs} +4 -9
- package/moveSortableArrayItemByKey.js +8 -4
- package/{node/moveSortableArrayItemByKey.js → moveSortableArrayItemByKey.mjs} +4 -8
- package/noop.js +6 -2
- package/noop.mjs +7 -0
- package/normaliseUrl.js +9 -4
- package/normaliseUrl.mjs +15 -0
- package/normaliseUrlPathname.js +9 -4
- package/normaliseUrlPathname.mjs +14 -0
- package/objectOmit.js +6 -2
- package/{node/objectOmit.js → objectOmit.mjs} +2 -6
- package/objectPick.js +6 -2
- package/{node/objectPick.js → objectPick.mjs} +2 -6
- package/package.json +4 -3
- package/parseCookie.js +6 -2
- package/{node/parseCookie.js → parseCookie.mjs} +2 -6
- package/parseURL.js +6 -2
- package/{node/parseURL.js → parseURL.mjs} +2 -6
- package/quaranteneProps.js +6 -2
- package/{node/quaranteneProps.js → quaranteneProps.mjs} +2 -6
- package/randomInt.js +6 -2
- package/randomInt.mjs +9 -0
- package/randomKey.js +6 -2
- package/{node/randomKey.js → randomKey.mjs} +2 -6
- package/readCookie.js +6 -2
- package/{node/readCookie.js → readCookie.mjs} +2 -6
- package/removeAccents.js +8 -4
- package/removeAccents.mjs +15 -0
- package/removeCookie.js +10 -6
- package/removeCookie.mjs +15 -0
- package/{node/removeDuplicates.js → removeDuplicates.mjs} +0 -0
- package/removeDuplicatesByKey.js +6 -2
- package/{node/removeDuplicatesByKey.js → removeDuplicatesByKey.mjs} +2 -6
- package/removeDuplicatesComparing.js +10 -6
- package/removeDuplicatesComparing.mjs +10 -0
- package/removeIndexesFromArray.js +6 -2
- package/removeIndexesFromArray.mjs +14 -0
- package/removeTrailingSlash.js +6 -2
- package/removeTrailingSlash.mjs +10 -0
- package/removeUrlQueryParams.js +11 -6
- package/removeUrlQueryParams.mjs +21 -0
- package/roundTo.js +6 -2
- package/{node/roundTo.js → roundTo.mjs} +2 -6
- package/serializeCookie.js +8 -4
- package/{node/serializeCookie.js → serializeCookie.mjs} +4 -8
- package/setCookie.js +14 -10
- package/{node/setCookie.js → setCookie.mjs} +10 -14
- package/shuffle.js +8 -4
- package/{node/shuffle.js → shuffle.mjs} +4 -8
- package/slugify.js +9 -5
- package/{node/slugify.js → slugify.mjs} +5 -9
- package/swapMap.js +6 -2
- package/{node/swapMap.js → swapMap.mjs} +2 -6
- package/throttle.js +8 -4
- package/{node/throttle.js → throttle.mjs} +4 -8
- package/titleCase.js +6 -2
- package/{node/titleCase.js → titleCase.mjs} +2 -6
- package/toNumber.js +8 -4
- package/toNumber.mjs +8 -0
- package/toRgba.js +6 -2
- package/{node/toRgba.js → toRgba.mjs} +2 -6
- package/transformToUrlPathname.js +9 -4
- package/transformToUrlPathname.mjs +16 -0
- package/truncate.js +6 -2
- package/truncate.mjs +13 -0
- package/tryUntil.js +6 -2
- package/{node/tryUntil.js → tryUntil.mjs} +2 -6
- package/types.js +2 -1
- package/types.mjs +1 -0
- package/uid.js +6 -2
- package/{node/uid.js → uid.mjs} +2 -6
- package/updateLinkParams.js +9 -4
- package/updateLinkParams.mjs +14 -0
- package/updateUrlQueryParams.js +12 -7
- package/updateUrlQueryParams.mjs +18 -0
- package/uppercase.js +6 -2
- package/uppercase.mjs +9 -0
- package/uuid.js +6 -2
- package/{node/uuid.js → uuid.mjs} +2 -6
- package/uuidNumeric.js +6 -2
- package/uuidNumeric.mjs +6 -0
- package/wait.js +6 -2
- package/wait.mjs +9 -0
- package/node/addOrReplaceAtIdx.js +0 -23
- package/node/arraySum.js +0 -13
- package/node/changeUrlPath.js +0 -23
- package/node/debouncePromise.js +0 -12
- package/node/ensureInt.js +0 -13
- package/node/forin.js +0 -15
- package/node/gbToBytes.js +0 -11
- package/node/getEmptyArray.js +0 -20
- package/node/getNonce.js +0 -13
- package/node/getParamAsString.js +0 -19
- package/node/imgEmptyPixel.js +0 -10
- package/node/index.js +0 -134
- package/node/isAnyObject.js +0 -15
- package/node/isArray.js +0 -15
- package/node/isBlob.js +0 -15
- package/node/isBoolean.js +0 -15
- package/node/isBrowser.js +0 -11
- package/node/isDate.js +0 -15
- package/node/isEmptyArray.js +0 -15
- package/node/isEmptyObject.js +0 -15
- package/node/isEmptyString.js +0 -13
- package/node/isError.js +0 -15
- package/node/isFile.js +0 -15
- package/node/isFloat.js +0 -15
- package/node/isFormData.js +0 -15
- package/node/isFullArray.js +0 -15
- package/node/isFullObject.js +0 -15
- package/node/isFullString.js +0 -15
- package/node/isFunction.js +0 -13
- package/node/isInt.js +0 -15
- package/node/isMap.js +0 -15
- package/node/isNaNValue.js +0 -15
- package/node/isNegativeNumber.js +0 -15
- package/node/isNull.js +0 -15
- package/node/isNullOrUndefined.js +0 -14
- package/node/isNumber.js +0 -17
- package/node/isObject.js +0 -15
- package/node/isObjectLike.js +0 -17
- package/node/isOneOf.js +0 -14
- package/node/isPlainObject.js +0 -18
- package/node/isPositiveNumber.js +0 -15
- package/node/isPrimitive.js +0 -25
- package/node/isPromise.js +0 -15
- package/node/isRegExp.js +0 -15
- package/node/isServer.js +0 -13
- package/node/isSet.js +0 -15
- package/node/isString.js +0 -15
- package/node/isSymbol.js +0 -15
- package/node/isUndefined.js +0 -15
- package/node/isWeakMap.js +0 -15
- package/node/isWeakSet.js +0 -15
- package/node/kbToBytes.js +0 -11
- package/node/location.js +0 -2
- package/node/lowercase.js +0 -13
- package/node/mbToBytes.js +0 -11
- package/node/noop.js +0 -11
- package/node/normaliseUrl.js +0 -20
- package/node/normaliseUrlPathname.js +0 -19
- package/node/randomInt.js +0 -13
- package/node/removeAccents.js +0 -19
- package/node/removeCookie.js +0 -19
- package/node/removeDuplicatesComparing.js +0 -14
- package/node/removeIndexesFromArray.js +0 -18
- package/node/removeTrailingSlash.js +0 -14
- package/node/removeUrlQueryParams.js +0 -26
- package/node/toNumber.js +0 -12
- package/node/transformToUrlPathname.js +0 -21
- package/node/truncate.js +0 -17
- package/node/types.js +0 -2
- package/node/updateLinkParams.js +0 -19
- package/node/updateUrlQueryParams.js +0 -23
- package/node/uppercase.js +0 -13
- package/node/uuidNumeric.js +0 -10
- package/node/wait.js +0 -13
|
@@ -1,14 +1,10 @@
|
|
|
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
|
*/
|
|
10
|
-
function clamp(num, min, max) {
|
|
7
|
+
export function clamp(num, min, max) {
|
|
11
8
|
return Math.min(Math.max(num, min), max);
|
|
12
9
|
}
|
|
13
|
-
|
|
14
|
-
exports.default = clamp;
|
|
10
|
+
export default clamp;
|
package/clsx.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.clsx = void 0;
|
|
1
4
|
// import _clsx from "clsx";
|
|
2
5
|
// export const clsx = _clsx;
|
|
3
6
|
function toVal(mix) {
|
|
@@ -33,7 +36,7 @@ function toVal(mix) {
|
|
|
33
36
|
* @borrows [lukeed/clsx](https://github.com/lukeed/clsx)
|
|
34
37
|
* @license [MIT: Luke Edwards](https://github.com/lukeed/clsx/blob/master/license)
|
|
35
38
|
*/
|
|
36
|
-
|
|
39
|
+
var clsx = function () {
|
|
37
40
|
var i = 0, tmp, x, str = "";
|
|
38
41
|
while (i < arguments.length) {
|
|
39
42
|
// eslint-disable-next-line prefer-rest-params
|
|
@@ -46,4 +49,5 @@ export var clsx = function () {
|
|
|
46
49
|
}
|
|
47
50
|
return str;
|
|
48
51
|
};
|
|
49
|
-
|
|
52
|
+
exports.clsx = clsx;
|
|
53
|
+
exports.default = exports.clsx;
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.clsx = void 0;
|
|
4
1
|
// import _clsx from "clsx";
|
|
5
2
|
// export const clsx = _clsx;
|
|
6
3
|
function toVal(mix) {
|
|
@@ -36,7 +33,7 @@ function toVal(mix) {
|
|
|
36
33
|
* @borrows [lukeed/clsx](https://github.com/lukeed/clsx)
|
|
37
34
|
* @license [MIT: Luke Edwards](https://github.com/lukeed/clsx/blob/master/license)
|
|
38
35
|
*/
|
|
39
|
-
var clsx = function () {
|
|
36
|
+
export var clsx = function () {
|
|
40
37
|
var i = 0, tmp, x, str = "";
|
|
41
38
|
while (i < arguments.length) {
|
|
42
39
|
// eslint-disable-next-line prefer-rest-params
|
|
@@ -49,5 +46,4 @@ var clsx = function () {
|
|
|
49
46
|
}
|
|
50
47
|
return str;
|
|
51
48
|
};
|
|
52
|
-
|
|
53
|
-
exports.default = exports.clsx;
|
|
49
|
+
export default clsx;
|
package/convertRange.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.convertRange = void 0;
|
|
1
4
|
/**
|
|
2
5
|
* Convert range of a number
|
|
3
6
|
*
|
|
@@ -10,7 +13,8 @@
|
|
|
10
13
|
* @category math
|
|
11
14
|
* @see https://stackoverflow.com/a/14224813
|
|
12
15
|
*/
|
|
13
|
-
|
|
16
|
+
function convertRange(num, r1, r2) {
|
|
14
17
|
return ((num - r1[0]) * (r2[1] - r2[0])) / (r1[1] - r1[0]) + r2[0];
|
|
15
18
|
}
|
|
16
|
-
|
|
19
|
+
exports.convertRange = convertRange;
|
|
20
|
+
exports.default = convertRange;
|
|
@@ -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
|
*
|
|
@@ -13,8 +10,7 @@ exports.convertRange = void 0;
|
|
|
13
10
|
* @category math
|
|
14
11
|
* @see https://stackoverflow.com/a/14224813
|
|
15
12
|
*/
|
|
16
|
-
function convertRange(num, r1, r2) {
|
|
13
|
+
export function convertRange(num, r1, r2) {
|
|
17
14
|
return ((num - r1[0]) * (r2[1] - r2[0])) / (r1[1] - r1[0]) + r2[0];
|
|
18
15
|
}
|
|
19
|
-
|
|
20
|
-
exports.default = convertRange;
|
|
16
|
+
export default convertRange;
|
package/cookie.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
/**
|
|
2
3
|
* @file
|
|
3
4
|
*
|
|
@@ -7,4 +8,6 @@
|
|
|
7
8
|
* - [js-cookie](https://github.com/js-cookie/js-cookie)
|
|
8
9
|
* - [cookie](https://github.com/jshttp/cookie)
|
|
9
10
|
*/
|
|
10
|
-
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.defaultAttributesClient = void 0;
|
|
13
|
+
exports.defaultAttributesClient = { path: "/" };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* @file
|
|
4
3
|
*
|
|
@@ -8,6 +7,4 @@
|
|
|
8
7
|
* - [js-cookie](https://github.com/js-cookie/js-cookie)
|
|
9
8
|
* - [cookie](https://github.com/jshttp/cookie)
|
|
10
9
|
*/
|
|
11
|
-
|
|
12
|
-
exports.defaultAttributesClient = void 0;
|
|
13
|
-
exports.defaultAttributesClient = { path: "/" };
|
|
10
|
+
export var defaultAttributesClient = { path: "/" };
|
package/debounce.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.debounce = void 0;
|
|
1
4
|
/**
|
|
2
5
|
* Debounce function (with `setTimeout`)
|
|
3
6
|
*
|
|
4
7
|
* @category function
|
|
5
8
|
* @borrows [davidwalsh/debounce](https://davidwalsh.name/javascript-debounce-function)
|
|
6
9
|
*/
|
|
7
|
-
|
|
10
|
+
function debounce(fn, wait, immediate) {
|
|
8
11
|
var timeout;
|
|
9
12
|
return function () {
|
|
10
13
|
var args = [];
|
|
@@ -26,4 +29,5 @@ export function debounce(fn, wait, immediate) {
|
|
|
26
29
|
fn.apply(context, args);
|
|
27
30
|
};
|
|
28
31
|
}
|
|
29
|
-
|
|
32
|
+
exports.debounce = debounce;
|
|
33
|
+
exports.default = debounce;
|
|
@@ -1,13 +1,10 @@
|
|
|
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
|
*/
|
|
10
|
-
function debounce(fn, wait, immediate) {
|
|
7
|
+
export function debounce(fn, wait, immediate) {
|
|
11
8
|
var timeout;
|
|
12
9
|
return function () {
|
|
13
10
|
var args = [];
|
|
@@ -29,5 +26,4 @@ function debounce(fn, wait, immediate) {
|
|
|
29
26
|
fn.apply(context, args);
|
|
30
27
|
};
|
|
31
28
|
}
|
|
32
|
-
|
|
33
|
-
exports.default = debounce;
|
|
29
|
+
export default debounce;
|
package/debouncePromise.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.debouncePromise = void 0;
|
|
4
|
+
var ts_debounce_1 = require("ts-debounce");
|
|
2
5
|
/**
|
|
3
6
|
* Debounce function (with `Promise`)
|
|
4
7
|
*
|
|
5
8
|
* @category function
|
|
6
9
|
* @borrows [chodorowicz/ts-debounce](https://github.com/chodorowicz/ts-debounce)
|
|
7
10
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
11
|
+
exports.debouncePromise = ts_debounce_1.debounce;
|
|
12
|
+
exports.default = exports.debouncePromise;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { debounce as tsDebounce } from "ts-debounce";
|
|
2
|
+
/**
|
|
3
|
+
* Debounce function (with `Promise`)
|
|
4
|
+
*
|
|
5
|
+
* @category function
|
|
6
|
+
* @borrows [chodorowicz/ts-debounce](https://github.com/chodorowicz/ts-debounce)
|
|
7
|
+
*/
|
|
8
|
+
export var debouncePromise = tsDebounce;
|
|
9
|
+
export default debouncePromise;
|
package/debounceRaf.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.debounceRaf = void 0;
|
|
1
4
|
/**
|
|
2
5
|
* Debounce function (with `requestAnimationFrame`)
|
|
3
6
|
*
|
|
@@ -5,7 +8,7 @@
|
|
|
5
8
|
* @category function
|
|
6
9
|
* @borrows [vanillajstoolkit/debounce](https://vanillajstoolkit.com/helpers/debounce/)
|
|
7
10
|
*/
|
|
8
|
-
|
|
11
|
+
function debounceRaf(fn) {
|
|
9
12
|
var timeout;
|
|
10
13
|
return function () {
|
|
11
14
|
var args = [];
|
|
@@ -24,4 +27,5 @@ export function debounceRaf(fn) {
|
|
|
24
27
|
});
|
|
25
28
|
};
|
|
26
29
|
}
|
|
27
|
-
|
|
30
|
+
exports.debounceRaf = debounceRaf;
|
|
31
|
+
exports.default = debounceRaf;
|
|
@@ -1,6 +1,3 @@
|
|
|
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
|
*
|
|
@@ -8,7 +5,7 @@ exports.debounceRaf = void 0;
|
|
|
8
5
|
* @category function
|
|
9
6
|
* @borrows [vanillajstoolkit/debounce](https://vanillajstoolkit.com/helpers/debounce/)
|
|
10
7
|
*/
|
|
11
|
-
function debounceRaf(fn) {
|
|
8
|
+
export function debounceRaf(fn) {
|
|
12
9
|
var timeout;
|
|
13
10
|
return function () {
|
|
14
11
|
var args = [];
|
|
@@ -27,5 +24,4 @@ function debounceRaf(fn) {
|
|
|
27
24
|
});
|
|
28
25
|
};
|
|
29
26
|
}
|
|
30
|
-
|
|
31
|
-
exports.default = debounceRaf;
|
|
27
|
+
export default debounceRaf;
|
package/decode.js
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.decode = void 0;
|
|
1
4
|
/**
|
|
2
5
|
* @category security
|
|
3
6
|
* @see https://stackoverflow.com/a/22405578/9122820
|
|
4
7
|
*/
|
|
5
|
-
|
|
8
|
+
function decode(str) {
|
|
6
9
|
return str.replace(/.{3}/g, function (c) {
|
|
7
10
|
return String.fromCharCode(parseInt(c, 10));
|
|
8
11
|
});
|
|
9
12
|
}
|
|
10
|
-
|
|
13
|
+
exports.decode = decode;
|
|
14
|
+
exports.default = decode;
|
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.decode = void 0;
|
|
4
1
|
/**
|
|
5
2
|
* @category security
|
|
6
3
|
* @see https://stackoverflow.com/a/22405578/9122820
|
|
7
4
|
*/
|
|
8
|
-
function decode(str) {
|
|
5
|
+
export function decode(str) {
|
|
9
6
|
return str.replace(/.{3}/g, function (c) {
|
|
10
7
|
return String.fromCharCode(parseInt(c, 10));
|
|
11
8
|
});
|
|
12
9
|
}
|
|
13
|
-
|
|
14
|
-
exports.default = decode;
|
|
10
|
+
export default decode;
|
package/encode.js
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.encode = void 0;
|
|
1
4
|
/**
|
|
2
5
|
* @category security
|
|
3
6
|
* @see https://stackoverflow.com/a/22405578/9122820
|
|
4
7
|
*/
|
|
5
|
-
|
|
8
|
+
function encode(str) {
|
|
6
9
|
return str.replace(/./g, function (c) {
|
|
7
10
|
return ("00" + c.charCodeAt(0)).slice(-3);
|
|
8
11
|
});
|
|
9
12
|
}
|
|
10
|
-
|
|
13
|
+
exports.encode = encode;
|
|
14
|
+
exports.default = encode;
|
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.encode = void 0;
|
|
4
1
|
/**
|
|
5
2
|
* @category security
|
|
6
3
|
* @see https://stackoverflow.com/a/22405578/9122820
|
|
7
4
|
*/
|
|
8
|
-
function encode(str) {
|
|
5
|
+
export function encode(str) {
|
|
9
6
|
return str.replace(/./g, function (c) {
|
|
10
7
|
return ("00" + c.charCodeAt(0)).slice(-3);
|
|
11
8
|
});
|
|
12
9
|
}
|
|
13
|
-
|
|
14
|
-
exports.default = encode;
|
|
10
|
+
export default encode;
|
package/ensureInt.js
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ensureInt = void 0;
|
|
1
4
|
/**
|
|
2
5
|
* Ensure input to be an integer
|
|
3
6
|
*
|
|
4
7
|
* @category cast
|
|
5
8
|
*/
|
|
6
|
-
|
|
9
|
+
var ensureInt = function (input) {
|
|
7
10
|
return typeof input === "string" ? parseInt(input, 10) : Math.round(input);
|
|
8
11
|
};
|
|
9
|
-
|
|
12
|
+
exports.ensureInt = ensureInt;
|
|
13
|
+
exports.default = exports.ensureInt;
|
package/ensureInt.mjs
ADDED
package/{node/env.js → env.mjs}
RENAMED
|
File without changes
|
package/findDuplicatedIndexes.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.findDuplicatedIndexes = void 0;
|
|
1
4
|
/**
|
|
2
5
|
* @category array
|
|
3
6
|
*/
|
|
4
|
-
|
|
7
|
+
function findDuplicatedIndexes(arr) {
|
|
5
8
|
var indexes = {};
|
|
6
9
|
for (var i = 0; i < arr.length; i++) {
|
|
7
10
|
var idxInArray = arr.indexOf(arr[i]);
|
|
@@ -11,4 +14,5 @@ export function findDuplicatedIndexes(arr) {
|
|
|
11
14
|
}
|
|
12
15
|
return indexes;
|
|
13
16
|
}
|
|
14
|
-
|
|
17
|
+
exports.findDuplicatedIndexes = findDuplicatedIndexes;
|
|
18
|
+
exports.default = findDuplicatedIndexes;
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.findDuplicatedIndexes = void 0;
|
|
4
1
|
/**
|
|
5
2
|
* @category array
|
|
6
3
|
*/
|
|
7
|
-
function findDuplicatedIndexes(arr) {
|
|
4
|
+
export function findDuplicatedIndexes(arr) {
|
|
8
5
|
var indexes = {};
|
|
9
6
|
for (var i = 0; i < arr.length; i++) {
|
|
10
7
|
var idxInArray = arr.indexOf(arr[i]);
|
|
@@ -14,5 +11,4 @@ function findDuplicatedIndexes(arr) {
|
|
|
14
11
|
}
|
|
15
12
|
return indexes;
|
|
16
13
|
}
|
|
17
|
-
|
|
18
|
-
exports.default = findDuplicatedIndexes;
|
|
14
|
+
export default findDuplicatedIndexes;
|
package/forin.js
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.forin = void 0;
|
|
1
4
|
/**
|
|
2
5
|
* To easily get typed native `for in`
|
|
3
6
|
*
|
|
4
7
|
* @category objects
|
|
5
8
|
*/
|
|
6
|
-
|
|
9
|
+
function forin(object, cb) {
|
|
7
10
|
for (var key in object) {
|
|
8
11
|
cb(key, object[key]);
|
|
9
12
|
}
|
|
10
13
|
}
|
|
11
|
-
|
|
14
|
+
exports.forin = forin;
|
|
15
|
+
exports.default = forin;
|
package/forin.mjs
ADDED
package/gbToBytes.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.gbToBytes = void 0;
|
|
1
4
|
/**
|
|
2
5
|
* Gigabytes to bytes
|
|
3
6
|
*
|
|
4
7
|
* @category format
|
|
5
8
|
*/
|
|
6
|
-
|
|
7
|
-
|
|
9
|
+
var gbToBytes = function (bytes) { return bytes * 1000 * 1000 * 1000; };
|
|
10
|
+
exports.gbToBytes = gbToBytes;
|
|
11
|
+
exports.default = exports.gbToBytes;
|
package/gbToBytes.mjs
ADDED
package/getEmptyArray.js
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getEmptyArray = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var isNumber_1 = tslib_1.__importDefault(require("./isNumber"));
|
|
2
6
|
/**
|
|
3
7
|
*
|
|
4
8
|
* Returns an array of undefined values of the desired length, useful to build
|
|
@@ -6,10 +10,11 @@ import isNumber from "./isNumber";
|
|
|
6
10
|
*
|
|
7
11
|
* @category array
|
|
8
12
|
*/
|
|
9
|
-
|
|
10
|
-
if (!
|
|
13
|
+
function getEmptyArray /* <T extends undefined | null = undefined> */(length) {
|
|
14
|
+
if (!(0, isNumber_1.default)(length)) {
|
|
11
15
|
length = parseInt(length, 10);
|
|
12
16
|
}
|
|
13
17
|
return Array.from({ length: length });
|
|
14
18
|
}
|
|
15
|
-
|
|
19
|
+
exports.getEmptyArray = getEmptyArray;
|
|
20
|
+
exports.default = getEmptyArray;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import isNumber from "./isNumber";
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* Returns an array of undefined values of the desired length, useful to build
|
|
5
|
+
* skeleton UIs.
|
|
6
|
+
*
|
|
7
|
+
* @category array
|
|
8
|
+
*/
|
|
9
|
+
export function getEmptyArray /* <T extends undefined | null = undefined> */(length) {
|
|
10
|
+
if (!isNumber(length)) {
|
|
11
|
+
length = parseInt(length, 10);
|
|
12
|
+
}
|
|
13
|
+
return Array.from({ length: length });
|
|
14
|
+
}
|
|
15
|
+
export default getEmptyArray;
|
package/getKeys.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getKeys = void 0;
|
|
1
4
|
/**
|
|
2
5
|
* Type safe replacement for `Object.keys(myObject)` to iterate over a record
|
|
3
6
|
* without loosing the key's types in simple `string`s.
|
|
@@ -5,5 +8,5 @@
|
|
|
5
8
|
* @category objects
|
|
6
9
|
* @see https://stackoverflow.com/a/59459000/1938970
|
|
7
10
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
11
|
+
exports.getKeys = Object.keys;
|
|
12
|
+
exports.default = exports.getKeys;
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getKeys = void 0;
|
|
4
1
|
/**
|
|
5
2
|
* Type safe replacement for `Object.keys(myObject)` to iterate over a record
|
|
6
3
|
* without loosing the key's types in simple `string`s.
|
|
@@ -8,5 +5,5 @@ exports.getKeys = void 0;
|
|
|
8
5
|
* @category objects
|
|
9
6
|
* @see https://stackoverflow.com/a/59459000/1938970
|
|
10
7
|
*/
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
export var getKeys = Object.keys;
|
|
9
|
+
export default getKeys;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getMediaQueryWidthResolvers = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
function getMediaQueryWidthResolvers(customBreakpoints) {
|
|
6
|
+
var breakpoints = tslib_1.__assign({ xs: 0 }, customBreakpoints);
|
|
4
7
|
var sortedBreakpointsNames = Object.keys(breakpoints).map(function (key) {
|
|
5
8
|
var br = key;
|
|
6
9
|
return [br, breakpoints[br]];
|
|
@@ -65,4 +68,5 @@ export function getMediaQueryWidthResolvers(customBreakpoints) {
|
|
|
65
68
|
only: only,
|
|
66
69
|
};
|
|
67
70
|
}
|
|
68
|
-
|
|
71
|
+
exports.getMediaQueryWidthResolvers = getMediaQueryWidthResolvers;
|
|
72
|
+
exports.default = getMediaQueryWidthResolvers;
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var tslib_1 = require("tslib");
|
|
5
|
-
function getMediaQueryWidthResolvers(customBreakpoints) {
|
|
6
|
-
var breakpoints = tslib_1.__assign({ xs: 0 }, customBreakpoints);
|
|
1
|
+
import { __assign } from "tslib";
|
|
2
|
+
export function getMediaQueryWidthResolvers(customBreakpoints) {
|
|
3
|
+
var breakpoints = __assign({ xs: 0 }, customBreakpoints);
|
|
7
4
|
var sortedBreakpointsNames = Object.keys(breakpoints).map(function (key) {
|
|
8
5
|
var br = key;
|
|
9
6
|
return [br, breakpoints[br]];
|
|
@@ -68,5 +65,4 @@ function getMediaQueryWidthResolvers(customBreakpoints) {
|
|
|
68
65
|
only: only,
|
|
69
66
|
};
|
|
70
67
|
}
|
|
71
|
-
|
|
72
|
-
exports.default = getMediaQueryWidthResolvers;
|
|
68
|
+
export default getMediaQueryWidthResolvers;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getMediaQueryWidthTailwindScreens = void 0;
|
|
4
|
+
var getMediaQueryWidthResolvers_1 = require("./getMediaQueryWidthResolvers");
|
|
5
|
+
function getMediaQueryWidthTailwindScreens(breakpoints) {
|
|
6
|
+
var mqWidthResolvers = (0, getMediaQueryWidthResolvers_1.getMediaQueryWidthResolvers)(breakpoints);
|
|
4
7
|
// Object.keys(breakpoints).reduce((screens, br) => {
|
|
5
8
|
var screens = Object.keys(breakpoints).reduce(function (output, br, idx) {
|
|
6
9
|
var brNext = Object.keys(breakpoints)[idx + 1];
|
|
@@ -26,4 +29,5 @@ export function getMediaQueryWidthTailwindScreens(breakpoints) {
|
|
|
26
29
|
}, {});
|
|
27
30
|
return screens;
|
|
28
31
|
}
|
|
29
|
-
|
|
32
|
+
exports.getMediaQueryWidthTailwindScreens = getMediaQueryWidthTailwindScreens;
|
|
33
|
+
exports.default = getMediaQueryWidthTailwindScreens;
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var getMediaQueryWidthResolvers_1 = require("./getMediaQueryWidthResolvers");
|
|
5
|
-
function getMediaQueryWidthTailwindScreens(breakpoints) {
|
|
6
|
-
var mqWidthResolvers = (0, getMediaQueryWidthResolvers_1.getMediaQueryWidthResolvers)(breakpoints);
|
|
1
|
+
import { getMediaQueryWidthResolvers, } from "./getMediaQueryWidthResolvers";
|
|
2
|
+
export function getMediaQueryWidthTailwindScreens(breakpoints) {
|
|
3
|
+
var mqWidthResolvers = getMediaQueryWidthResolvers(breakpoints);
|
|
7
4
|
// Object.keys(breakpoints).reduce((screens, br) => {
|
|
8
5
|
var screens = Object.keys(breakpoints).reduce(function (output, br, idx) {
|
|
9
6
|
var brNext = Object.keys(breakpoints)[idx + 1];
|
|
@@ -29,5 +26,4 @@ function getMediaQueryWidthTailwindScreens(breakpoints) {
|
|
|
29
26
|
}, {});
|
|
30
27
|
return screens;
|
|
31
28
|
}
|
|
32
|
-
|
|
33
|
-
exports.default = getMediaQueryWidthTailwindScreens;
|
|
29
|
+
export default getMediaQueryWidthTailwindScreens;
|
package/getNonce.js
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getNonce = void 0;
|
|
4
|
+
var isUndefined_1 = require("./isUndefined");
|
|
2
5
|
/**
|
|
3
6
|
* @category security
|
|
4
7
|
* @see https://github.com/styled-components/styled-components/blob/main/packages/styled-components/src/utils/nonce.ts
|
|
5
8
|
*/
|
|
6
|
-
|
|
7
|
-
return isUndefined(__webpack_nonce__) ? null : __webpack_nonce__;
|
|
9
|
+
function getNonce() {
|
|
10
|
+
return (0, isUndefined_1.isUndefined)(__webpack_nonce__) ? null : __webpack_nonce__;
|
|
8
11
|
}
|
|
9
|
-
|
|
12
|
+
exports.getNonce = getNonce;
|
|
13
|
+
exports.default = getNonce;
|
package/getNonce.mjs
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { isUndefined } from "./isUndefined";
|
|
2
|
+
/**
|
|
3
|
+
* @category security
|
|
4
|
+
* @see https://github.com/styled-components/styled-components/blob/main/packages/styled-components/src/utils/nonce.ts
|
|
5
|
+
*/
|
|
6
|
+
export function getNonce() {
|
|
7
|
+
return isUndefined(__webpack_nonce__) ? null : __webpack_nonce__;
|
|
8
|
+
}
|
|
9
|
+
export default getNonce;
|
package/getParamAmong.js
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getParamAmong = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var getParamAsString_1 = tslib_1.__importDefault(require("./getParamAsString"));
|
|
2
6
|
/**
|
|
3
7
|
* Get query parameter as `string` treating the `ParsedUrlQuery` result of
|
|
4
8
|
* [`querystring`](https://nodejs.org/api/querystring.html) (used in next.js
|
|
@@ -9,9 +13,10 @@ import getParamAsString from "./getParamAsString";
|
|
|
9
13
|
* @param {string} [raw] - The _raw_ query parameter
|
|
10
14
|
* @param {string[]} [allowedValues=[]] - The list of values (as strings) that the parameter can have, if not one of them `null` is returned
|
|
11
15
|
*/
|
|
12
|
-
|
|
16
|
+
function getParamAmong(raw, allowedValues) {
|
|
13
17
|
if (allowedValues === void 0) { allowedValues = []; }
|
|
14
|
-
var string =
|
|
18
|
+
var string = (0, getParamAsString_1.default)(raw);
|
|
15
19
|
return allowedValues.includes(string) ? string : null;
|
|
16
20
|
}
|
|
17
|
-
|
|
21
|
+
exports.getParamAmong = getParamAmong;
|
|
22
|
+
exports.default = getParamAmong;
|