@koine/utils 2.0.0-beta.2 → 2.0.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Defer.js +23 -18
- package/Defer.mjs +6 -5
- package/Emitter.js +31 -20
- package/Emitter.mjs +13 -16
- package/README.md +5 -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.js +29 -23
- package/clsx.mjs +11 -14
- package/convertRange.js +20 -7
- package/convertRange.mjs +2 -3
- package/cookie.js +13 -5
- package/cookie.mjs +3 -2
- package/createPalette.js +27 -19
- package/createPalette.mjs +9 -6
- package/debounce.js +27 -21
- package/debounce.mjs +9 -17
- package/debouncePromise.js +20 -11
- package/debouncePromise.mjs +1 -2
- 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.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 +11 -8
- 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/toNumber.mjs
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { isNumber } from "./isNumber";
|
|
2
2
|
/**
|
|
3
3
|
* @category cast
|
|
4
|
-
*/
|
|
5
|
-
export function toNumber(input, fallback) {
|
|
4
|
+
*/ export function toNumber(input, fallback) {
|
|
6
5
|
return isNumber(input) ? input : input ? parseFloat(input) : fallback || 0;
|
|
7
6
|
}
|
|
8
7
|
export default toNumber;
|
package/toRgba.js
CHANGED
|
@@ -1,20 +1,32 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
// import hexRgb from "hex-rgb";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.toRgba = void 0;
|
|
5
2
|
// export const toRgb = (hexColor: string) => hexRgb(hexColor, { format: "css" });
|
|
6
3
|
// export const toRgba = (hexColor: string, alpha: number) =>
|
|
7
4
|
// hexRgb(hexColor, { format: "css", alpha });
|
|
8
5
|
/**
|
|
9
6
|
* @category colors
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
*/ "use strict";
|
|
8
|
+
Object.defineProperty(exports, "__esModule", {
|
|
9
|
+
value: true
|
|
10
|
+
});
|
|
11
|
+
function _export(target, all) {
|
|
12
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: all[name]
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
_export(exports, {
|
|
18
|
+
toRgba: function() {
|
|
19
|
+
return toRgba;
|
|
20
|
+
},
|
|
21
|
+
default: function() {
|
|
22
|
+
return _default;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
function toRgba(hex, alpha = 1) {
|
|
26
|
+
const r = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
|
14
27
|
if (r) {
|
|
15
|
-
return
|
|
28
|
+
return `rgba(${parseInt(r[1], 16)},${parseInt(r[2], 16)},${parseInt(r[3], 16)},${alpha})`;
|
|
16
29
|
}
|
|
17
30
|
return "";
|
|
18
31
|
}
|
|
19
|
-
|
|
20
|
-
exports.default = toRgba;
|
|
32
|
+
const _default = toRgba;
|
package/toRgba.mjs
CHANGED
|
@@ -4,12 +4,10 @@
|
|
|
4
4
|
// hexRgb(hexColor, { format: "css", alpha });
|
|
5
5
|
/**
|
|
6
6
|
* @category colors
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
if (alpha === void 0) { alpha = 1; }
|
|
10
|
-
var r = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
|
7
|
+
*/ export function toRgba(hex, alpha = 1) {
|
|
8
|
+
const r = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
|
11
9
|
if (r) {
|
|
12
|
-
return
|
|
10
|
+
return `rgba(${parseInt(r[1], 16)},${parseInt(r[2], 16)},${parseInt(r[3], 16)},${alpha})`;
|
|
13
11
|
}
|
|
14
12
|
return "";
|
|
15
13
|
}
|
|
@@ -1,21 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
+
transformToUrlPathname: function() {
|
|
13
|
+
return transformToUrlPathname;
|
|
14
|
+
},
|
|
15
|
+
default: function() {
|
|
16
|
+
return _default;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
|
|
20
|
+
const _isString = /*#__PURE__*/ _interop_require_default._(require("./isString"));
|
|
15
21
|
function transformToUrlPathname(toPathname) {
|
|
16
|
-
return (0,
|
|
17
|
-
? "/".concat(encodeURIComponent(toPathname.replace(/\s/g, "-").toLowerCase()))
|
|
18
|
-
: "";
|
|
22
|
+
return (0, _isString.default)(toPathname) ? `/${encodeURIComponent(toPathname.replace(/\s/g, "-").toLowerCase())}` : "";
|
|
19
23
|
}
|
|
20
|
-
|
|
21
|
-
exports.default = transformToUrlPathname;
|
|
24
|
+
const _default = transformToUrlPathname;
|
|
@@ -7,10 +7,7 @@ import isString from "./isString";
|
|
|
7
7
|
* - replaces whitespaces with dashes
|
|
8
8
|
*
|
|
9
9
|
* @category location
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
return isString(toPathname)
|
|
13
|
-
? "/".concat(encodeURIComponent(toPathname.replace(/\s/g, "-").toLowerCase()))
|
|
14
|
-
: "";
|
|
10
|
+
*/ export function transformToUrlPathname(toPathname) {
|
|
11
|
+
return isString(toPathname) ? `/${encodeURIComponent(toPathname.replace(/\s/g, "-").toLowerCase())}` : "";
|
|
15
12
|
}
|
|
16
13
|
export default transformToUrlPathname;
|
package/truncate.js
CHANGED
|
@@ -1,17 +1,24 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.truncate = void 0;
|
|
4
1
|
/**
|
|
5
2
|
* Truncate string
|
|
6
3
|
*
|
|
7
4
|
* @category typography
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
:
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
5
|
+
*/ "use strict";
|
|
6
|
+
Object.defineProperty(exports, "__esModule", {
|
|
7
|
+
value: true
|
|
8
|
+
});
|
|
9
|
+
function _export(target, all) {
|
|
10
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: all[name]
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
_export(exports, {
|
|
16
|
+
truncate: function() {
|
|
17
|
+
return truncate;
|
|
18
|
+
},
|
|
19
|
+
default: function() {
|
|
20
|
+
return _default;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
const truncate = (input, length)=>input ? input.length > length ? input.substring(0, length) + "..." : input : "";
|
|
24
|
+
const _default = truncate;
|
package/truncate.mjs
CHANGED
|
@@ -2,12 +2,5 @@
|
|
|
2
2
|
* Truncate string
|
|
3
3
|
*
|
|
4
4
|
* @category typography
|
|
5
|
-
*/
|
|
6
|
-
export var truncate = function (input, length) {
|
|
7
|
-
return input
|
|
8
|
-
? input.length > length
|
|
9
|
-
? input.substring(0, length) + "..."
|
|
10
|
-
: input
|
|
11
|
-
: "";
|
|
12
|
-
};
|
|
5
|
+
*/ export const truncate = (input, length)=>input ? input.length > length ? input.substring(0, length) + "..." : input : "";
|
|
13
6
|
export default truncate;
|
package/tryUntil.js
CHANGED
|
@@ -1,31 +1,42 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.tryUntil = void 0;
|
|
4
1
|
/**
|
|
5
2
|
* @borrows [https://levelup.gitconnected.com/javascript-wait-until-something-happens-or-timeout-82636839ea93]
|
|
6
3
|
*
|
|
7
4
|
* @param timeout in `ms`
|
|
8
5
|
* @param interval in `ms`
|
|
9
|
-
*/
|
|
10
|
-
|
|
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
|
+
tryUntil: function() {
|
|
18
|
+
return tryUntil;
|
|
19
|
+
},
|
|
20
|
+
default: function() {
|
|
21
|
+
return _default;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
const tryUntil = (test, timeout, interval, resolve, reject)=>{
|
|
11
25
|
// return new Promise((resolve, reject) => {
|
|
12
|
-
|
|
13
|
-
|
|
26
|
+
const timeWas = new Date();
|
|
27
|
+
const wait = setInterval(function() {
|
|
14
28
|
if (test()) {
|
|
15
29
|
// console.log("resolved after", new Date() - timeWas, "ms");
|
|
16
30
|
clearInterval(wait);
|
|
17
31
|
resolve();
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
else if (new Date() - timeWas > timeout) {
|
|
32
|
+
// @ts-expect-error ...
|
|
33
|
+
} else if (new Date() - timeWas > timeout) {
|
|
21
34
|
// Timeout
|
|
22
35
|
// console.log("rejected after", new Date() - timeWas, "ms");
|
|
23
36
|
clearInterval(wait);
|
|
24
|
-
if (reject)
|
|
25
|
-
reject();
|
|
37
|
+
if (reject) reject();
|
|
26
38
|
}
|
|
27
39
|
}, interval);
|
|
28
|
-
|
|
40
|
+
// });
|
|
29
41
|
};
|
|
30
|
-
|
|
31
|
-
exports.default = exports.tryUntil;
|
|
42
|
+
const _default = tryUntil;
|
package/tryUntil.mjs
CHANGED
|
@@ -3,25 +3,22 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @param timeout in `ms`
|
|
5
5
|
* @param interval in `ms`
|
|
6
|
-
*/
|
|
7
|
-
export var tryUntil = function (test, timeout, interval, resolve, reject) {
|
|
6
|
+
*/ export const tryUntil = (test, timeout, interval, resolve, reject)=>{
|
|
8
7
|
// return new Promise((resolve, reject) => {
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
const timeWas = new Date();
|
|
9
|
+
const wait = setInterval(function() {
|
|
11
10
|
if (test()) {
|
|
12
11
|
// console.log("resolved after", new Date() - timeWas, "ms");
|
|
13
12
|
clearInterval(wait);
|
|
14
13
|
resolve();
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
else if (new Date() - timeWas > timeout) {
|
|
14
|
+
// @ts-expect-error ...
|
|
15
|
+
} else if (new Date() - timeWas > timeout) {
|
|
18
16
|
// Timeout
|
|
19
17
|
// console.log("rejected after", new Date() - timeWas, "ms");
|
|
20
18
|
clearInterval(wait);
|
|
21
|
-
if (reject)
|
|
22
|
-
reject();
|
|
19
|
+
if (reject) reject();
|
|
23
20
|
}
|
|
24
21
|
}, interval);
|
|
25
|
-
|
|
22
|
+
// });
|
|
26
23
|
};
|
|
27
24
|
export default tryUntil;
|
package/types.js
CHANGED
package/types.mjs
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
// import type { Replace } from "@koine/utils";
|
|
2
|
+
export { };
|
package/uid.js
CHANGED
|
@@ -1,16 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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
|
+
uid: function() {
|
|
13
|
+
return uid;
|
|
14
|
+
},
|
|
15
|
+
default: function() {
|
|
16
|
+
return _default;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
let lastId = 0;
|
|
20
|
+
const uid = (prefix = "id")=>{
|
|
12
21
|
lastId++;
|
|
13
|
-
return
|
|
22
|
+
return `${prefix}-${lastId}`;
|
|
14
23
|
};
|
|
15
|
-
|
|
16
|
-
exports.default = exports.uid;
|
|
24
|
+
const _default = uid;
|
package/uid.mjs
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
let lastId = 0;
|
|
2
2
|
/**
|
|
3
3
|
* Super basic UID increment-based generator
|
|
4
4
|
*
|
|
5
5
|
* @category uid
|
|
6
|
-
*/
|
|
7
|
-
export var uid = function (prefix) {
|
|
8
|
-
if (prefix === void 0) { prefix = "id"; }
|
|
6
|
+
*/ export const uid = (prefix = "id")=>{
|
|
9
7
|
lastId++;
|
|
10
|
-
return
|
|
8
|
+
return `${prefix}-${lastId}`;
|
|
11
9
|
};
|
|
12
10
|
export default uid;
|
package/updateLinkParams.js
CHANGED
|
@@ -1,19 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
+
updateLinkParams: function() {
|
|
13
|
+
return updateLinkParams;
|
|
14
|
+
},
|
|
15
|
+
default: function() {
|
|
16
|
+
return _default;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
|
|
20
|
+
const _updateUrlQueryParams = /*#__PURE__*/ _interop_require_default._(require("./updateUrlQueryParams"));
|
|
13
21
|
function updateLinkParams($anchor, newParams) {
|
|
14
|
-
|
|
22
|
+
const href = (0, _updateUrlQueryParams.default)($anchor.href, newParams);
|
|
15
23
|
$anchor.href = href;
|
|
16
24
|
return href;
|
|
17
25
|
}
|
|
18
|
-
|
|
19
|
-
exports.default = updateLinkParams;
|
|
26
|
+
const _default = updateLinkParams;
|
package/updateLinkParams.mjs
CHANGED
|
@@ -5,9 +5,8 @@ import updateUrlQueryParams from "./updateUrlQueryParams";
|
|
|
5
5
|
*
|
|
6
6
|
* @category location
|
|
7
7
|
* @pure
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
var href = updateUrlQueryParams($anchor.href, newParams);
|
|
8
|
+
*/ export function updateLinkParams($anchor, newParams) {
|
|
9
|
+
const href = updateUrlQueryParams($anchor.href, newParams);
|
|
11
10
|
$anchor.href = href;
|
|
12
11
|
return href;
|
|
13
12
|
}
|
package/updateUrlQueryParams.js
CHANGED
|
@@ -1,23 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
*
|
|
11
|
-
* @category location
|
|
12
|
-
* @pure
|
|
13
|
-
*/
|
|
14
|
-
function updateUrlQueryParams(url, newParams) {
|
|
15
|
-
if (newParams === void 0) { newParams = {}; }
|
|
16
|
-
var parts = url.split("?");
|
|
17
|
-
var allParams = parts[1]
|
|
18
|
-
? (0, mergeUrlQueryParams_1.default)((0, getUrlQueryParams_1.default)(url), newParams)
|
|
19
|
-
: newParams;
|
|
20
|
-
return parts[0] + (0, buildUrlQueryString_1.default)(allParams);
|
|
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
|
+
});
|
|
21
10
|
}
|
|
22
|
-
exports
|
|
23
|
-
|
|
11
|
+
_export(exports, {
|
|
12
|
+
updateUrlQueryParams: function() {
|
|
13
|
+
return updateUrlQueryParams;
|
|
14
|
+
},
|
|
15
|
+
default: function() {
|
|
16
|
+
return _default;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
|
|
20
|
+
const _buildUrlQueryString = /*#__PURE__*/ _interop_require_default._(require("./buildUrlQueryString"));
|
|
21
|
+
const _getUrlQueryParams = /*#__PURE__*/ _interop_require_default._(require("./getUrlQueryParams"));
|
|
22
|
+
const _mergeUrlQueryParams = /*#__PURE__*/ _interop_require_default._(require("./mergeUrlQueryParams"));
|
|
23
|
+
function updateUrlQueryParams(url, newParams = {}) {
|
|
24
|
+
const parts = url.split("?");
|
|
25
|
+
const allParams = parts[1] ? (0, _mergeUrlQueryParams.default)((0, _getUrlQueryParams.default)(url), newParams) : newParams;
|
|
26
|
+
return parts[0] + (0, _buildUrlQueryString.default)(allParams);
|
|
27
|
+
}
|
|
28
|
+
const _default = updateUrlQueryParams;
|
package/updateUrlQueryParams.mjs
CHANGED
|
@@ -6,13 +6,9 @@ import mergeUrlQueryParams from "./mergeUrlQueryParams";
|
|
|
6
6
|
*
|
|
7
7
|
* @category location
|
|
8
8
|
* @pure
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
var parts = url.split("?");
|
|
13
|
-
var allParams = parts[1]
|
|
14
|
-
? mergeUrlQueryParams(getUrlQueryParams(url), newParams)
|
|
15
|
-
: newParams;
|
|
9
|
+
*/ export function updateUrlQueryParams(url, newParams = {}) {
|
|
10
|
+
const parts = url.split("?");
|
|
11
|
+
const allParams = parts[1] ? mergeUrlQueryParams(getUrlQueryParams(url), newParams) : newParams;
|
|
16
12
|
return parts[0] + buildUrlQueryString(allParams);
|
|
17
13
|
}
|
|
18
14
|
export default updateUrlQueryParams;
|
package/uppercase.js
CHANGED
|
@@ -1,13 +1,24 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.uppercase = void 0;
|
|
4
1
|
/**
|
|
5
2
|
* Replacement for native `toUpperCase` tyescript ready (type narrowing ready)
|
|
6
3
|
*
|
|
7
4
|
* @category native
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
|
|
5
|
+
*/ "use strict";
|
|
6
|
+
Object.defineProperty(exports, "__esModule", {
|
|
7
|
+
value: true
|
|
8
|
+
});
|
|
9
|
+
function _export(target, all) {
|
|
10
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: all[name]
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
_export(exports, {
|
|
16
|
+
uppercase: function() {
|
|
17
|
+
return uppercase;
|
|
18
|
+
},
|
|
19
|
+
default: function() {
|
|
20
|
+
return _default;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
const uppercase = (str)=>(str || "").toUpperCase();
|
|
24
|
+
const _default = uppercase;
|
package/uppercase.mjs
CHANGED
|
@@ -2,8 +2,5 @@
|
|
|
2
2
|
* Replacement for native `toUpperCase` tyescript ready (type narrowing ready)
|
|
3
3
|
*
|
|
4
4
|
* @category native
|
|
5
|
-
*/
|
|
6
|
-
export var uppercase = function (str) {
|
|
7
|
-
return (str || "").toUpperCase();
|
|
8
|
-
};
|
|
5
|
+
*/ export const uppercase = (str)=>(str || "").toUpperCase();
|
|
9
6
|
export default uppercase;
|
package/uuid.js
CHANGED
|
@@ -1,17 +1,28 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.uuid = void 0;
|
|
4
1
|
/**
|
|
5
2
|
* Uuid, tiny custom helper instead of node's uuid/v4
|
|
6
3
|
*
|
|
7
4
|
* @category uid
|
|
8
5
|
* @see https://stackoverflow.com/a/2117523/1938970
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
+
uuid: function() {
|
|
18
|
+
return uuid;
|
|
19
|
+
},
|
|
20
|
+
default: function() {
|
|
21
|
+
return _default;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
const uuid = ()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c)=>{
|
|
25
|
+
const r = Math.random() * 16 | 0, v = c == "x" ? r : r & 0x3 | 0x8;
|
|
13
26
|
return v.toString(16);
|
|
14
27
|
});
|
|
15
|
-
|
|
16
|
-
exports.uuid = uuid;
|
|
17
|
-
exports.default = exports.uuid;
|
|
28
|
+
const _default = uuid;
|
package/uuid.mjs
CHANGED
|
@@ -3,11 +3,8 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @category uid
|
|
5
5
|
* @see https://stackoverflow.com/a/2117523/1938970
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) {
|
|
9
|
-
var r = (Math.random() * 16) | 0, v = c == "x" ? r : (r & 0x3) | 0x8;
|
|
6
|
+
*/ export const uuid = ()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c)=>{
|
|
7
|
+
const r = Math.random() * 16 | 0, v = c == "x" ? r : r & 0x3 | 0x8;
|
|
10
8
|
return v.toString(16);
|
|
11
9
|
});
|
|
12
|
-
};
|
|
13
10
|
export default uuid;
|
package/uuidNumeric.js
CHANGED
|
@@ -1,10 +1,23 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.uuidNumeric = void 0;
|
|
4
1
|
/**
|
|
5
2
|
* @category uid
|
|
6
3
|
* @see https://stackoverflow.com/a/18048162/1938970
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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
|
+
uuidNumeric: function() {
|
|
16
|
+
return uuidNumeric;
|
|
17
|
+
},
|
|
18
|
+
default: function() {
|
|
19
|
+
return _default;
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
const uuidNumeric = ()=>new Date().valueOf();
|
|
23
|
+
const _default = uuidNumeric;
|
package/uuidNumeric.mjs
CHANGED
package/wait.js
CHANGED
|
@@ -1,13 +1,24 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.wait = void 0;
|
|
4
1
|
/**
|
|
5
2
|
* A promisified `setTimeout`
|
|
6
3
|
*
|
|
7
4
|
* @category async
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
|
|
5
|
+
*/ "use strict";
|
|
6
|
+
Object.defineProperty(exports, "__esModule", {
|
|
7
|
+
value: true
|
|
8
|
+
});
|
|
9
|
+
function _export(target, all) {
|
|
10
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: all[name]
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
_export(exports, {
|
|
16
|
+
wait: function() {
|
|
17
|
+
return wait;
|
|
18
|
+
},
|
|
19
|
+
default: function() {
|
|
20
|
+
return _default;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
const wait = (milliseconds)=>new Promise((resolve)=>setTimeout(resolve, milliseconds));
|
|
24
|
+
const _default = wait;
|
package/wait.mjs
CHANGED
|
@@ -2,8 +2,5 @@
|
|
|
2
2
|
* A promisified `setTimeout`
|
|
3
3
|
*
|
|
4
4
|
* @category async
|
|
5
|
-
*/
|
|
6
|
-
export var wait = function (milliseconds) {
|
|
7
|
-
return new Promise(function (resolve) { return setTimeout(resolve, milliseconds); });
|
|
8
|
-
};
|
|
5
|
+
*/ export const wait = (milliseconds)=>new Promise((resolve)=>setTimeout(resolve, milliseconds));
|
|
9
6
|
export default wait;
|