@koine/utils 1.1.10 → 1.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +10 -8
- 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
package/Defer.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Defer = void 0;
|
|
1
4
|
/**
|
|
2
5
|
* @category async
|
|
3
6
|
* @see https://stackoverflow.com/a/37673534/1938970
|
|
@@ -9,7 +12,7 @@
|
|
|
9
12
|
* deferred.then(handleSuccess, handleError);
|
|
10
13
|
* ```
|
|
11
14
|
*/
|
|
12
|
-
|
|
15
|
+
function Defer() {
|
|
13
16
|
// @ts-expect-error nevermind
|
|
14
17
|
var self = this || {};
|
|
15
18
|
var p = (self.promise = new Promise(function (resolve, reject) {
|
|
@@ -23,4 +26,5 @@ export function Defer() {
|
|
|
23
26
|
// }
|
|
24
27
|
return self;
|
|
25
28
|
}
|
|
26
|
-
|
|
29
|
+
exports.Defer = Defer;
|
|
30
|
+
exports.default = Defer;
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Defer = void 0;
|
|
4
1
|
/**
|
|
5
2
|
* @category async
|
|
6
3
|
* @see https://stackoverflow.com/a/37673534/1938970
|
|
@@ -12,7 +9,7 @@ exports.Defer = void 0;
|
|
|
12
9
|
* deferred.then(handleSuccess, handleError);
|
|
13
10
|
* ```
|
|
14
11
|
*/
|
|
15
|
-
function Defer() {
|
|
12
|
+
export function Defer() {
|
|
16
13
|
// @ts-expect-error nevermind
|
|
17
14
|
var self = this || {};
|
|
18
15
|
var p = (self.promise = new Promise(function (resolve, reject) {
|
|
@@ -26,5 +23,4 @@ function Defer() {
|
|
|
26
23
|
// }
|
|
27
24
|
return self;
|
|
28
25
|
}
|
|
29
|
-
|
|
30
|
-
exports.default = Defer;
|
|
26
|
+
export default Defer;
|
package/Emitter.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Emitter = void 0;
|
|
1
4
|
/**
|
|
2
5
|
* Emitter super simple class
|
|
3
6
|
*
|
|
@@ -10,7 +13,7 @@
|
|
|
10
13
|
* - https://stackoverflow.com/q/53299743/1938970
|
|
11
14
|
* - https://github.com/Microsoft/TypeScript/pull/26349
|
|
12
15
|
*/
|
|
13
|
-
|
|
16
|
+
function Emitter(namespace) {
|
|
14
17
|
var all = new Map();
|
|
15
18
|
return {
|
|
16
19
|
/**
|
|
@@ -35,4 +38,5 @@ export function Emitter(namespace) {
|
|
|
35
38
|
},
|
|
36
39
|
};
|
|
37
40
|
}
|
|
38
|
-
|
|
41
|
+
exports.Emitter = Emitter;
|
|
42
|
+
exports.default = Emitter;
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Emitter = void 0;
|
|
4
1
|
/**
|
|
5
2
|
* Emitter super simple class
|
|
6
3
|
*
|
|
@@ -13,7 +10,7 @@ exports.Emitter = void 0;
|
|
|
13
10
|
* - https://stackoverflow.com/q/53299743/1938970
|
|
14
11
|
* - https://github.com/Microsoft/TypeScript/pull/26349
|
|
15
12
|
*/
|
|
16
|
-
function Emitter(namespace) {
|
|
13
|
+
export function Emitter(namespace) {
|
|
17
14
|
var all = new Map();
|
|
18
15
|
return {
|
|
19
16
|
/**
|
|
@@ -38,5 +35,4 @@ function Emitter(namespace) {
|
|
|
38
35
|
},
|
|
39
36
|
};
|
|
40
37
|
}
|
|
41
|
-
|
|
42
|
-
exports.default = Emitter;
|
|
38
|
+
export default Emitter;
|
package/accentSets.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.accentsSets = void 0;
|
|
1
4
|
/**
|
|
2
5
|
* Accent sets
|
|
3
6
|
*
|
|
@@ -6,7 +9,7 @@
|
|
|
6
9
|
* @see https://gist.github.com/eek/9c4887e80b3ede05c0e39fee4dce3747 for usage
|
|
7
10
|
* of [normalize](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize)
|
|
8
11
|
*/
|
|
9
|
-
|
|
12
|
+
exports.accentsSets = [
|
|
10
13
|
["a", "ÀÁÂÃÅÆĀĂĄẠẢẤẦẨẪẬẮẰẲẴẶ"],
|
|
11
14
|
["ae", "Ä"],
|
|
12
15
|
["c", "ÇĆĈČ"],
|
|
@@ -35,4 +38,4 @@ export var accentsSets = [
|
|
|
35
38
|
["y", "ÝŶŸỲỴỶỸ"],
|
|
36
39
|
["z", "ŹŻŽ"],
|
|
37
40
|
];
|
|
38
|
-
|
|
41
|
+
exports.default = exports.accentsSets;
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.accentsSets = void 0;
|
|
4
1
|
/**
|
|
5
2
|
* Accent sets
|
|
6
3
|
*
|
|
@@ -9,7 +6,7 @@ exports.accentsSets = void 0;
|
|
|
9
6
|
* @see https://gist.github.com/eek/9c4887e80b3ede05c0e39fee4dce3747 for usage
|
|
10
7
|
* of [normalize](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize)
|
|
11
8
|
*/
|
|
12
|
-
|
|
9
|
+
export var accentsSets = [
|
|
13
10
|
["a", "ÀÁÂÃÅÆĀĂĄẠẢẤẦẨẪẬẮẰẲẴẶ"],
|
|
14
11
|
["ae", "Ä"],
|
|
15
12
|
["c", "ÇĆĈČ"],
|
|
@@ -38,4 +35,4 @@ exports.accentsSets = [
|
|
|
38
35
|
["y", "ÝŶŸỲỴỶỸ"],
|
|
39
36
|
["z", "ŹŻŽ"],
|
|
40
37
|
];
|
|
41
|
-
|
|
38
|
+
export default accentsSets;
|
package/addOrReplaceAtIdx.js
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addOrReplaceAtIdx = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
2
5
|
/**
|
|
3
6
|
* @category array
|
|
4
7
|
*/
|
|
5
|
-
|
|
8
|
+
function addOrReplaceAtIdx(list, newItem, newIdx) {
|
|
6
9
|
if (list.length === 0) {
|
|
7
10
|
return [newItem];
|
|
8
11
|
}
|
|
9
12
|
if (typeof newIdx === "undefined" || list.length - 1 < newIdx) {
|
|
10
|
-
return __spreadArray(__spreadArray([], list, true), [newItem], false);
|
|
13
|
+
return tslib_1.__spreadArray(tslib_1.__spreadArray([], list, true), [newItem], false);
|
|
11
14
|
}
|
|
12
15
|
return list.map(function (item, idx) {
|
|
13
16
|
if (idx === newIdx) {
|
|
@@ -16,4 +19,5 @@ export function addOrReplaceAtIdx(list, newItem, newIdx) {
|
|
|
16
19
|
return item;
|
|
17
20
|
});
|
|
18
21
|
}
|
|
19
|
-
|
|
22
|
+
exports.addOrReplaceAtIdx = addOrReplaceAtIdx;
|
|
23
|
+
exports.default = addOrReplaceAtIdx;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { __spreadArray } from "tslib";
|
|
2
|
+
/**
|
|
3
|
+
* @category array
|
|
4
|
+
*/
|
|
5
|
+
export function addOrReplaceAtIdx(list, newItem, newIdx) {
|
|
6
|
+
if (list.length === 0) {
|
|
7
|
+
return [newItem];
|
|
8
|
+
}
|
|
9
|
+
if (typeof newIdx === "undefined" || list.length - 1 < newIdx) {
|
|
10
|
+
return __spreadArray(__spreadArray([], list, true), [newItem], false);
|
|
11
|
+
}
|
|
12
|
+
return list.map(function (item, idx) {
|
|
13
|
+
if (idx === newIdx) {
|
|
14
|
+
return newItem;
|
|
15
|
+
}
|
|
16
|
+
return item;
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
export default addOrReplaceAtIdx;
|
package/areEqual.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.areEqual = void 0;
|
|
4
|
+
var isArray_1 = require("./isArray");
|
|
5
|
+
var isObject_1 = require("./isObject");
|
|
3
6
|
function areEqualArrays(a, b) {
|
|
4
7
|
if (!b)
|
|
5
8
|
return false;
|
|
@@ -47,7 +50,7 @@ function areEqualObjects(a, b) {
|
|
|
47
50
|
*
|
|
48
51
|
* @category objects
|
|
49
52
|
*/
|
|
50
|
-
|
|
53
|
+
function areEqual(a, b) {
|
|
51
54
|
if (!a && !b) {
|
|
52
55
|
// console.log(`areEqual took ${performance.now() - t0} ms`);
|
|
53
56
|
return true;
|
|
@@ -57,12 +60,12 @@ export function areEqual(a, b) {
|
|
|
57
60
|
// console.log(`areEqual took ${performance.now() - t0} ms`);
|
|
58
61
|
return false;
|
|
59
62
|
}
|
|
60
|
-
var areObjects = isObject(a) && isObject(b);
|
|
63
|
+
var areObjects = (0, isObject_1.isObject)(a) && (0, isObject_1.isObject)(b);
|
|
61
64
|
if (areObjects && !areEqualObjects(a, b)) {
|
|
62
65
|
// console.log(`areEqual took ${performance.now() - t0} ms`);
|
|
63
66
|
return false;
|
|
64
67
|
}
|
|
65
|
-
var areArrays = isArray(a) && isArray(b);
|
|
68
|
+
var areArrays = (0, isArray_1.isArray)(a) && (0, isArray_1.isArray)(b);
|
|
66
69
|
if (areArrays && !areEqualArrays(a, b)) {
|
|
67
70
|
// console.log(`areEqual took ${performance.now() - t0} ms`);
|
|
68
71
|
return false;
|
|
@@ -74,4 +77,5 @@ export function areEqual(a, b) {
|
|
|
74
77
|
// console.log(`areEqual took ${performance.now() - t0} ms`);
|
|
75
78
|
return true;
|
|
76
79
|
}
|
|
77
|
-
|
|
80
|
+
exports.areEqual = areEqual;
|
|
81
|
+
exports.default = areEqual;
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.areEqual = void 0;
|
|
4
|
-
var isArray_1 = require("./isArray");
|
|
5
|
-
var isObject_1 = require("./isObject");
|
|
1
|
+
import { isArray } from "./isArray";
|
|
2
|
+
import { isObject } from "./isObject";
|
|
6
3
|
function areEqualArrays(a, b) {
|
|
7
4
|
if (!b)
|
|
8
5
|
return false;
|
|
@@ -50,7 +47,7 @@ function areEqualObjects(a, b) {
|
|
|
50
47
|
*
|
|
51
48
|
* @category objects
|
|
52
49
|
*/
|
|
53
|
-
function areEqual(a, b) {
|
|
50
|
+
export function areEqual(a, b) {
|
|
54
51
|
if (!a && !b) {
|
|
55
52
|
// console.log(`areEqual took ${performance.now() - t0} ms`);
|
|
56
53
|
return true;
|
|
@@ -60,12 +57,12 @@ function areEqual(a, b) {
|
|
|
60
57
|
// console.log(`areEqual took ${performance.now() - t0} ms`);
|
|
61
58
|
return false;
|
|
62
59
|
}
|
|
63
|
-
var areObjects =
|
|
60
|
+
var areObjects = isObject(a) && isObject(b);
|
|
64
61
|
if (areObjects && !areEqualObjects(a, b)) {
|
|
65
62
|
// console.log(`areEqual took ${performance.now() - t0} ms`);
|
|
66
63
|
return false;
|
|
67
64
|
}
|
|
68
|
-
var areArrays =
|
|
65
|
+
var areArrays = isArray(a) && isArray(b);
|
|
69
66
|
if (areArrays && !areEqualArrays(a, b)) {
|
|
70
67
|
// console.log(`areEqual took ${performance.now() - t0} ms`);
|
|
71
68
|
return false;
|
|
@@ -77,5 +74,4 @@ function areEqual(a, b) {
|
|
|
77
74
|
// console.log(`areEqual took ${performance.now() - t0} ms`);
|
|
78
75
|
return true;
|
|
79
76
|
}
|
|
80
|
-
|
|
81
|
-
exports.default = areEqual;
|
|
77
|
+
export default areEqual;
|
package/arrayOfAll.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.arrayOfAll = void 0;
|
|
1
4
|
/**
|
|
2
5
|
* Ensure an array contains all deisred values
|
|
3
6
|
*
|
|
@@ -24,9 +27,10 @@
|
|
|
24
27
|
* ```
|
|
25
28
|
*
|
|
26
29
|
*/
|
|
27
|
-
|
|
30
|
+
var arrayOfAll = function () {
|
|
28
31
|
return function (array) {
|
|
29
32
|
return array;
|
|
30
33
|
};
|
|
31
34
|
};
|
|
32
|
-
|
|
35
|
+
exports.arrayOfAll = arrayOfAll;
|
|
36
|
+
exports.default = exports.arrayOfAll;
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.arrayOfAll = void 0;
|
|
4
1
|
/**
|
|
5
2
|
* Ensure an array contains all deisred values
|
|
6
3
|
*
|
|
@@ -27,10 +24,9 @@ exports.arrayOfAll = void 0;
|
|
|
27
24
|
* ```
|
|
28
25
|
*
|
|
29
26
|
*/
|
|
30
|
-
var arrayOfAll = function () {
|
|
27
|
+
export var arrayOfAll = function () {
|
|
31
28
|
return function (array) {
|
|
32
29
|
return array;
|
|
33
30
|
};
|
|
34
31
|
};
|
|
35
|
-
|
|
36
|
-
exports.default = exports.arrayOfAll;
|
|
32
|
+
export default arrayOfAll;
|
package/arraySum.js
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.arraySum = void 0;
|
|
1
4
|
/**
|
|
2
5
|
* Sum array of numbers
|
|
3
6
|
*
|
|
4
7
|
* @category array | math
|
|
5
8
|
*/
|
|
6
|
-
|
|
9
|
+
var arraySum = function (numbers) {
|
|
7
10
|
return numbers.reduce(function (sum, current) { return sum + current; }, 0);
|
|
8
11
|
};
|
|
9
|
-
|
|
12
|
+
exports.arraySum = arraySum;
|
|
13
|
+
exports.default = exports.arraySum;
|
package/arraySum.mjs
ADDED
package/arrayToLookup.js
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.arrayToLookup = void 0;
|
|
1
4
|
/**
|
|
2
5
|
* Maps a simple flat array to a lookup dictionary object
|
|
3
6
|
*
|
|
4
7
|
* @category array
|
|
5
8
|
*/
|
|
6
|
-
|
|
9
|
+
function arrayToLookup(array) {
|
|
7
10
|
if (array === void 0) { array = []; }
|
|
8
11
|
return array.reduce(function (obj, item) {
|
|
9
12
|
obj[item] = 1;
|
|
10
13
|
return obj;
|
|
11
14
|
}, {});
|
|
12
15
|
}
|
|
13
|
-
|
|
16
|
+
exports.arrayToLookup = arrayToLookup;
|
|
17
|
+
exports.default = arrayToLookup;
|
|
@@ -1,17 +1,13 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.arrayToLookup = void 0;
|
|
4
1
|
/**
|
|
5
2
|
* Maps a simple flat array to a lookup dictionary object
|
|
6
3
|
*
|
|
7
4
|
* @category array
|
|
8
5
|
*/
|
|
9
|
-
function arrayToLookup(array) {
|
|
6
|
+
export function arrayToLookup(array) {
|
|
10
7
|
if (array === void 0) { array = []; }
|
|
11
8
|
return array.reduce(function (obj, item) {
|
|
12
9
|
obj[item] = 1;
|
|
13
10
|
return obj;
|
|
14
11
|
}, {});
|
|
15
12
|
}
|
|
16
|
-
|
|
17
|
-
exports.default = arrayToLookup;
|
|
13
|
+
export default arrayToLookup;
|
package/buildUrlQueryString.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildUrlQueryString = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var isNull_1 = tslib_1.__importDefault(require("./isNull"));
|
|
6
|
+
var isUndefined_1 = tslib_1.__importDefault(require("./isUndefined"));
|
|
7
|
+
var isArray_1 = tslib_1.__importDefault(require("./isArray"));
|
|
4
8
|
/**
|
|
5
9
|
* Get clean query string for URL
|
|
6
10
|
*
|
|
@@ -10,22 +14,23 @@ import isArray from "./isArray";
|
|
|
10
14
|
*
|
|
11
15
|
* @category location
|
|
12
16
|
*/
|
|
13
|
-
|
|
17
|
+
function buildUrlQueryString(params) {
|
|
14
18
|
var output = "";
|
|
15
19
|
if (!params)
|
|
16
20
|
return output;
|
|
17
21
|
for (var key in params) {
|
|
18
22
|
var value = params[key];
|
|
19
|
-
if (
|
|
23
|
+
if ((0, isArray_1.default)(value)) {
|
|
20
24
|
for (var i = 0; i < value.length; i++) {
|
|
21
25
|
output += "".concat(key, "=").concat(encodeURIComponent(value[i] + ""), "&");
|
|
22
26
|
}
|
|
23
27
|
}
|
|
24
|
-
else if (!
|
|
28
|
+
else if (!(0, isNull_1.default)(value) && !(0, isUndefined_1.default)(value)) {
|
|
25
29
|
output += "".concat(key, "=").concat(encodeURIComponent(value + ""), "&");
|
|
26
30
|
}
|
|
27
31
|
}
|
|
28
32
|
// removes the last &
|
|
29
33
|
return output ? "?".concat(output.replace(/&+$/, "")) : "";
|
|
30
34
|
}
|
|
31
|
-
|
|
35
|
+
exports.buildUrlQueryString = buildUrlQueryString;
|
|
36
|
+
exports.default = buildUrlQueryString;
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var tslib_1 = require("tslib");
|
|
5
|
-
var isNull_1 = tslib_1.__importDefault(require("./isNull"));
|
|
6
|
-
var isUndefined_1 = tslib_1.__importDefault(require("./isUndefined"));
|
|
7
|
-
var isArray_1 = tslib_1.__importDefault(require("./isArray"));
|
|
1
|
+
import isNull from "./isNull";
|
|
2
|
+
import isUndefined from "./isUndefined";
|
|
3
|
+
import isArray from "./isArray";
|
|
8
4
|
/**
|
|
9
5
|
* Get clean query string for URL
|
|
10
6
|
*
|
|
@@ -14,23 +10,22 @@ var isArray_1 = tslib_1.__importDefault(require("./isArray"));
|
|
|
14
10
|
*
|
|
15
11
|
* @category location
|
|
16
12
|
*/
|
|
17
|
-
function buildUrlQueryString(params) {
|
|
13
|
+
export function buildUrlQueryString(params) {
|
|
18
14
|
var output = "";
|
|
19
15
|
if (!params)
|
|
20
16
|
return output;
|
|
21
17
|
for (var key in params) {
|
|
22
18
|
var value = params[key];
|
|
23
|
-
if ((
|
|
19
|
+
if (isArray(value)) {
|
|
24
20
|
for (var i = 0; i < value.length; i++) {
|
|
25
21
|
output += "".concat(key, "=").concat(encodeURIComponent(value[i] + ""), "&");
|
|
26
22
|
}
|
|
27
23
|
}
|
|
28
|
-
else if (!(
|
|
24
|
+
else if (!isNull(value) && !isUndefined(value)) {
|
|
29
25
|
output += "".concat(key, "=").concat(encodeURIComponent(value + ""), "&");
|
|
30
26
|
}
|
|
31
27
|
}
|
|
32
28
|
// removes the last &
|
|
33
29
|
return output ? "?".concat(output.replace(/&+$/, "")) : "";
|
|
34
30
|
}
|
|
35
|
-
|
|
36
|
-
exports.default = buildUrlQueryString;
|
|
31
|
+
export default buildUrlQueryString;
|
package/capitalize.js
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.capitalize = void 0;
|
|
1
4
|
/**
|
|
2
5
|
* Capitalize first letter of the given string.
|
|
3
6
|
*
|
|
4
7
|
* @category text
|
|
5
8
|
* @see https://stackoverflow.com/a/11409944/1938970
|
|
6
9
|
*/
|
|
7
|
-
|
|
10
|
+
function capitalize(string) {
|
|
8
11
|
var ensuredString = string || "";
|
|
9
12
|
return (ensuredString.charAt(0).toUpperCase() +
|
|
10
13
|
ensuredString.slice(1));
|
|
11
14
|
}
|
|
12
|
-
|
|
15
|
+
exports.capitalize = capitalize;
|
|
16
|
+
exports.default = capitalize;
|
|
@@ -1,16 +1,12 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.capitalize = void 0;
|
|
4
1
|
/**
|
|
5
2
|
* Capitalize first letter of the given string.
|
|
6
3
|
*
|
|
7
4
|
* @category text
|
|
8
5
|
* @see https://stackoverflow.com/a/11409944/1938970
|
|
9
6
|
*/
|
|
10
|
-
function capitalize(string) {
|
|
7
|
+
export function capitalize(string) {
|
|
11
8
|
var ensuredString = string || "";
|
|
12
9
|
return (ensuredString.charAt(0).toUpperCase() +
|
|
13
10
|
ensuredString.slice(1));
|
|
14
11
|
}
|
|
15
|
-
|
|
16
|
-
exports.default = capitalize;
|
|
12
|
+
export default capitalize;
|
package/changeUrlPath.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.changeUrlPath = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var isBrowser_1 = tslib_1.__importDefault(require("./isBrowser"));
|
|
6
|
+
var normaliseUrlPathname_1 = tslib_1.__importDefault(require("./normaliseUrlPathname"));
|
|
3
7
|
/**
|
|
4
8
|
* Change URL path, ensures initial and ending slashes and normalise eventual
|
|
5
9
|
* consecutive slashes, it uses `history`.
|
|
@@ -8,11 +12,12 @@ import normaliseUrlPathname from "./normaliseUrlPathname";
|
|
|
8
12
|
* @param replace Replace URL instead of pushing it in the history stack. By default it pushes it.
|
|
9
13
|
* @returns {string} The new cleaned pathname
|
|
10
14
|
*/
|
|
11
|
-
|
|
12
|
-
var path =
|
|
13
|
-
if (
|
|
15
|
+
function changeUrlPath(pathname, state, replace) {
|
|
16
|
+
var path = (0, normaliseUrlPathname_1.default)("/".concat(pathname, "/"));
|
|
17
|
+
if (isBrowser_1.default) {
|
|
14
18
|
history[replace ? "replaceState" : "pushState"](state, "", path);
|
|
15
19
|
}
|
|
16
20
|
return path;
|
|
17
21
|
}
|
|
18
|
-
|
|
22
|
+
exports.changeUrlPath = changeUrlPath;
|
|
23
|
+
exports.default = changeUrlPath;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import isBrowser from "./isBrowser";
|
|
2
|
+
import normaliseUrlPathname from "./normaliseUrlPathname";
|
|
3
|
+
/**
|
|
4
|
+
* Change URL path, ensures initial and ending slashes and normalise eventual
|
|
5
|
+
* consecutive slashes, it uses `history`.
|
|
6
|
+
*
|
|
7
|
+
* @category location
|
|
8
|
+
* @param replace Replace URL instead of pushing it in the history stack. By default it pushes it.
|
|
9
|
+
* @returns {string} The new cleaned pathname
|
|
10
|
+
*/
|
|
11
|
+
export function changeUrlPath(pathname, state, replace) {
|
|
12
|
+
var path = normaliseUrlPathname("/".concat(pathname, "/"));
|
|
13
|
+
if (isBrowser) {
|
|
14
|
+
history[replace ? "replaceState" : "pushState"](state, "", path);
|
|
15
|
+
}
|
|
16
|
+
return path;
|
|
17
|
+
}
|
|
18
|
+
export default changeUrlPath;
|
package/chunkByChunks.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.chunkByChunks = void 0;
|
|
1
4
|
/**
|
|
2
5
|
* TODO: untested
|
|
3
6
|
* @category array
|
|
4
7
|
* @see https://stackoverflow.com/a/8189268/1938970
|
|
5
8
|
*/
|
|
6
|
-
|
|
9
|
+
function chunkByChunks(arr, nrOfChunks, balanced) {
|
|
7
10
|
if (nrOfChunks < 2)
|
|
8
11
|
return [arr];
|
|
9
12
|
var len = arr.length;
|
|
@@ -34,4 +37,5 @@ export function chunkByChunks(arr, nrOfChunks, balanced) {
|
|
|
34
37
|
}
|
|
35
38
|
return output;
|
|
36
39
|
}
|
|
37
|
-
|
|
40
|
+
exports.chunkByChunks = chunkByChunks;
|
|
41
|
+
exports.default = chunkByChunks;
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.chunkByChunks = void 0;
|
|
4
1
|
/**
|
|
5
2
|
* TODO: untested
|
|
6
3
|
* @category array
|
|
7
4
|
* @see https://stackoverflow.com/a/8189268/1938970
|
|
8
5
|
*/
|
|
9
|
-
function chunkByChunks(arr, nrOfChunks, balanced) {
|
|
6
|
+
export function chunkByChunks(arr, nrOfChunks, balanced) {
|
|
10
7
|
if (nrOfChunks < 2)
|
|
11
8
|
return [arr];
|
|
12
9
|
var len = arr.length;
|
|
@@ -37,5 +34,4 @@ function chunkByChunks(arr, nrOfChunks, balanced) {
|
|
|
37
34
|
}
|
|
38
35
|
return output;
|
|
39
36
|
}
|
|
40
|
-
|
|
41
|
-
exports.default = chunkByChunks;
|
|
37
|
+
export default chunkByChunks;
|
package/chunkBySize.js
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.chunkBySize = void 0;
|
|
1
4
|
/**
|
|
2
5
|
* @category array
|
|
3
6
|
* @see https://stackoverflow.com/a/40682136/1938970
|
|
4
7
|
*/
|
|
5
|
-
|
|
8
|
+
function chunkBySize(arr, size) {
|
|
6
9
|
var output = [];
|
|
7
10
|
for (var i = 0; i < arr.length; i += size) {
|
|
8
11
|
output.push(arr.slice(i, i + size));
|
|
9
12
|
}
|
|
10
13
|
return output;
|
|
11
14
|
}
|
|
12
|
-
|
|
15
|
+
exports.chunkBySize = chunkBySize;
|
|
16
|
+
exports.default = chunkBySize;
|
|
@@ -1,16 +1,12 @@
|
|
|
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
|
*/
|
|
8
|
-
function chunkBySize(arr, size) {
|
|
5
|
+
export function chunkBySize(arr, size) {
|
|
9
6
|
var output = [];
|
|
10
7
|
for (var i = 0; i < arr.length; i += size) {
|
|
11
8
|
output.push(arr.slice(i, i + size));
|
|
12
9
|
}
|
|
13
10
|
return output;
|
|
14
11
|
}
|
|
15
|
-
|
|
16
|
-
exports.default = chunkBySize;
|
|
12
|
+
export default chunkBySize;
|
package/clamp.js
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.clamp = void 0;
|
|
1
4
|
/**
|
|
2
5
|
* Returns a number whose value is limited to the given range.
|
|
3
6
|
*
|
|
4
7
|
* @category math
|
|
5
8
|
* @see https://stackoverflow.com/a/11409944/1938970
|
|
6
9
|
*/
|
|
7
|
-
|
|
10
|
+
function clamp(num, min, max) {
|
|
8
11
|
return Math.min(Math.max(num, min), max);
|
|
9
12
|
}
|
|
10
|
-
|
|
13
|
+
exports.clamp = clamp;
|
|
14
|
+
exports.default = clamp;
|