@koine/utils 2.0.0-beta.1 → 2.0.0-beta.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.mjs +6 -5
- package/Emitter.d.ts +3 -1
- package/Emitter.mjs +16 -17
- package/README.md +6 -1
- package/accentSets.d.ts +3 -2
- package/accentSets.mjs +116 -31
- package/addOrReplaceAtIdx.d.ts +4 -0
- package/addOrReplaceAtIdx.mjs +13 -6
- package/areEqual.d.ts +1 -1
- package/areEqual.mjs +17 -23
- package/arrayOfAll.d.ts +1 -2
- package/arrayOfAll.mjs +2 -8
- package/arraySum.d.ts +2 -1
- package/arraySum.mjs +3 -5
- package/arrayToLookup.mjs +2 -4
- package/buildUrlQueryString.mjs +11 -14
- package/capitalize.d.ts +2 -1
- package/capitalize.mjs +5 -6
- package/changeUrlPath.mjs +2 -3
- package/chunkByChunks.d.ts +1 -1
- package/chunkByChunks.mjs +18 -21
- package/chunkBySize.mjs +3 -4
- package/clamp.mjs +1 -2
- package/clsx.d.ts +6 -2
- package/clsx.mjs +14 -15
- package/convertRange.d.ts +3 -1
- package/convertRange.mjs +5 -4
- package/cookie.d.ts +13 -1
- package/cookie.mjs +8 -3
- package/createPalette.d.ts +3 -1
- package/createPalette.mjs +17 -7
- package/debounce.mjs +9 -17
- package/debouncePromise.d.ts +22 -4
- package/debouncePromise.mjs +73 -3
- package/debounceRaf.d.ts +1 -1
- package/debounceRaf.mjs +6 -11
- package/decode.mjs +2 -3
- package/encode.mjs +2 -3
- package/ensureInt.mjs +1 -4
- package/env.mjs +0 -1
- package/errorToString.d.ts +2 -1
- package/errorToString.mjs +3 -5
- package/findDuplicatedIndexes.mjs +4 -5
- package/forin.d.ts +2 -1
- package/forin.mjs +4 -4
- package/gbToBytes.mjs +1 -2
- package/getEmptyArray.d.ts +0 -1
- package/getEmptyArray.mjs +4 -4
- package/getKeys.d.ts +2 -1
- package/getKeys.mjs +3 -3
- package/getMediaQueryWidthResolvers.d.ts +6 -0
- package/getMediaQueryWidthResolvers.mjs +49 -50
- package/getMediaQueryWidthTailwindScreens.d.ts +4 -0
- package/getMediaQueryWidthTailwindScreens.mjs +22 -15
- package/getNonce.mjs +1 -2
- package/getParamAmong.d.ts +3 -2
- package/getParamAmong.mjs +5 -6
- package/getParamAsInt.d.ts +2 -2
- package/getParamAsInt.mjs +4 -6
- package/getParamAsString.d.ts +1 -1
- package/getParamAsString.mjs +2 -3
- package/getType.d.ts +0 -3
- package/getType.mjs +2 -7
- package/getUrlHashParams.mjs +2 -4
- package/getUrlHashPathname.mjs +1 -3
- package/getUrlPathnameParts.mjs +2 -7
- package/getUrlQueryParams.d.ts +3 -4
- package/getUrlQueryParams.mjs +10 -22
- package/imgEmptyPixel.mjs +1 -2
- package/index.d.ts +5 -2
- package/index.mjs +2 -2
- package/invariant.mjs +6 -8
- package/isAnyObject.mjs +1 -2
- package/isArray.mjs +1 -2
- package/isBlob.mjs +1 -2
- package/isBoolean.mjs +1 -2
- package/isBrowser.mjs +1 -2
- package/isBrowserNow.mjs +1 -2
- package/isDate.mjs +1 -2
- package/isEmptyArray.mjs +1 -2
- package/isEmptyObject.mjs +1 -2
- package/isEmptyString.mjs +1 -2
- package/isError.mjs +1 -2
- package/isExternalUrl.mjs +4 -6
- package/isFile.mjs +1 -2
- package/isFloat.mjs +1 -2
- package/isFormData.mjs +1 -2
- package/isFullArray.mjs +1 -2
- package/isFullObject.mjs +1 -2
- package/isFullString.mjs +1 -2
- package/isFunction.mjs +1 -2
- package/isInt.mjs +1 -2
- package/isMap.mjs +1 -2
- package/isNaNValue.mjs +1 -2
- package/isNegativeNumber.mjs +1 -2
- package/isNull.mjs +1 -2
- package/isNullOrUndefined.mjs +1 -2
- package/isNumber.mjs +1 -2
- package/isObject.mjs +1 -2
- package/isObjectLike.mjs +1 -2
- package/isOneOf.mjs +1 -7
- package/isPlainObject.mjs +3 -6
- package/isPositiveNumber.mjs +1 -2
- package/isPrimitive.mjs +5 -11
- package/isPromise.mjs +1 -2
- package/isRegExp.mjs +1 -2
- package/isServer.mjs +1 -2
- package/isServerNow.mjs +1 -2
- package/isSet.mjs +1 -2
- package/isString.mjs +1 -2
- package/isSymbol.mjs +1 -2
- package/isType.mjs +3 -5
- package/isUndefined.mjs +1 -2
- package/isWeakMap.mjs +1 -2
- package/isWeakSet.mjs +1 -2
- package/kbToBytes.mjs +1 -2
- package/location.mjs +3 -1
- package/lowercase.mjs +1 -4
- package/mapListBy.mjs +2 -5
- package/matchSorter.mjs +110 -128
- package/mbToBytes.mjs +1 -2
- package/mergeObjects.d.ts +2 -2
- package/mergeObjects.mjs +13 -16
- package/mergeUrlQueryParams.d.ts +0 -1
- package/mergeUrlQueryParams.mjs +4 -9
- package/moveSortableArrayItemByKey.d.ts +1 -1
- package/moveSortableArrayItemByKey.mjs +9 -9
- package/noop.mjs +1 -2
- package/normaliseUrl.mjs +1 -3
- package/normaliseUrlPathname.mjs +1 -3
- package/objectOmit.d.ts +1 -1
- package/objectOmit.mjs +4 -6
- package/objectPick.d.ts +1 -1
- package/objectPick.mjs +5 -6
- package/package.json +7 -11
- package/parseCookie.mjs +11 -15
- package/parseURL.mjs +5 -6
- package/quaranteneProps.d.ts +1 -1
- package/quaranteneProps.mjs +7 -9
- package/randomInt.mjs +1 -2
- package/randomKey.mjs +3 -4
- package/readCookie.d.ts +5 -0
- package/readCookie.mjs +7 -8
- package/removeAccents.mjs +5 -8
- package/removeCookie.d.ts +0 -4
- package/removeCookie.mjs +6 -9
- package/removeDuplicates.mjs +0 -1
- package/removeDuplicatesByKey.mjs +5 -7
- package/removeDuplicatesComparing.mjs +3 -4
- package/removeIndexesFromArray.mjs +3 -4
- package/removeTrailingSlash.mjs +1 -3
- package/removeUrlQueryParams.d.ts +0 -1
- package/removeUrlQueryParams.mjs +5 -8
- package/render.d.ts +2 -1
- package/render.mjs +45 -99
- package/roundTo.mjs +15 -17
- package/serializeCookie.d.ts +1 -5
- package/serializeCookie.mjs +10 -20
- package/setCookie.d.ts +0 -4
- package/setCookie.mjs +13 -20
- package/shuffle.d.ts +7 -6
- package/shuffle.mjs +17 -16
- package/slugify.d.ts +2 -1
- package/slugify.mjs +15 -12
- package/split.d.ts +4 -0
- package/split.mjs +4 -1
- package/swapMap.d.ts +1 -1
- package/swapMap.mjs +4 -6
- package/throttle.d.ts +2 -1
- package/throttle.mjs +6 -12
- package/titleCase.d.ts +4 -3
- package/titleCase.mjs +5 -9
- package/toNumber.mjs +1 -2
- package/toRgba.mjs +3 -5
- package/transformToUrlPathname.mjs +2 -5
- package/truncate.d.ts +1 -1
- package/truncate.mjs +2 -9
- package/tryUntil.d.ts +4 -1
- package/tryUntil.mjs +11 -11
- package/types.mjs +2 -1
- package/typings.d.ts +1 -6
- package/uid.mjs +3 -5
- package/updateLinkParams.mjs +2 -3
- package/updateUrlQueryParams.d.ts +0 -1
- package/updateUrlQueryParams.mjs +3 -8
- package/uppercase.d.ts +1 -0
- package/uppercase.mjs +2 -4
- package/uuid.mjs +2 -5
- package/uuidNumeric.mjs +1 -2
- package/wait.mjs +1 -4
- package/without.mjs +1 -3
- package/Defer.js +0 -30
- package/Emitter.js +0 -42
- package/accentSets.js +0 -41
- package/addOrReplaceAtIdx.js +0 -23
- package/areEqual.js +0 -81
- package/arrayOfAll.js +0 -36
- package/arraySum.js +0 -13
- package/arrayToLookup.js +0 -17
- package/buildUrlQueryString.js +0 -36
- package/capitalize.js +0 -16
- package/changeUrlPath.js +0 -23
- package/chunkByChunks.js +0 -41
- package/chunkBySize.js +0 -16
- package/clamp.js +0 -14
- package/clsx.js +0 -53
- package/convertRange.js +0 -20
- package/cookie.js +0 -13
- package/createPalette.js +0 -26
- package/debounce.js +0 -33
- package/debouncePromise.js +0 -12
- package/debounceRaf.js +0 -31
- package/decode.js +0 -14
- package/encode.js +0 -14
- package/ensureInt.js +0 -13
- package/env.js +0 -3
- package/errorToString.js +0 -15
- package/findDuplicatedIndexes.js +0 -18
- package/forin.js +0 -15
- package/gbToBytes.js +0 -11
- package/getEmptyArray.js +0 -20
- package/getKeys.js +0 -12
- package/getMediaQueryWidthResolvers.js +0 -72
- package/getMediaQueryWidthTailwindScreens.js +0 -33
- package/getNonce.js +0 -13
- package/getParamAmong.js +0 -22
- package/getParamAsInt.js +0 -25
- package/getParamAsString.js +0 -19
- package/getType.js +0 -23
- package/getUrlHashParams.js +0 -20
- package/getUrlHashPathname.js +0 -17
- package/getUrlPathnameParts.js +0 -25
- package/getUrlQueryParams.js +0 -43
- package/imgEmptyPixel.js +0 -10
- package/index.js +0 -267
- package/invariant.js +0 -38
- package/isAnyObject.js +0 -15
- package/isArray.js +0 -15
- package/isBlob.js +0 -15
- package/isBoolean.js +0 -15
- package/isBrowser.js +0 -9
- package/isBrowserNow.js +0 -12
- package/isDate.js +0 -15
- package/isEmptyArray.js +0 -15
- package/isEmptyObject.js +0 -15
- package/isEmptyString.js +0 -13
- package/isError.js +0 -15
- package/isExternalUrl.js +0 -26
- package/isFile.js +0 -15
- package/isFloat.js +0 -15
- package/isFormData.js +0 -15
- package/isFullArray.js +0 -15
- package/isFullObject.js +0 -15
- package/isFullString.js +0 -15
- package/isFunction.js +0 -13
- package/isInt.js +0 -15
- package/isMap.js +0 -15
- package/isNaNValue.js +0 -15
- package/isNegativeNumber.js +0 -15
- package/isNull.js +0 -15
- package/isNullOrUndefined.js +0 -14
- package/isNumber.js +0 -17
- package/isObject.js +0 -15
- package/isObjectLike.js +0 -17
- package/isOneOf.js +0 -14
- package/isPlainObject.js +0 -18
- package/isPositiveNumber.js +0 -15
- package/isPrimitive.js +0 -25
- package/isPromise.js +0 -15
- package/isRegExp.js +0 -15
- package/isServer.js +0 -12
- package/isServerNow.js +0 -12
- package/isSet.js +0 -15
- package/isString.js +0 -15
- package/isSymbol.js +0 -15
- package/isType.js +0 -27
- package/isUndefined.js +0 -15
- package/isWeakMap.js +0 -15
- package/isWeakSet.js +0 -15
- package/kbToBytes.js +0 -11
- package/location.js +0 -2
- package/lowercase.js +0 -13
- package/mapListBy.js +0 -18
- package/matchSorter.js +0 -374
- package/mbToBytes.js +0 -11
- package/mergeObjects.js +0 -41
- package/mergeUrlQueryParams.js +0 -27
- package/moveSortableArrayItemByKey.js +0 -21
- package/noop.js +0 -11
- package/normaliseUrl.js +0 -20
- package/normaliseUrlPathname.js +0 -19
- package/objectOmit.js +0 -23
- package/objectPick.js +0 -19
- package/parseCookie.js +0 -52
- package/parseURL.js +0 -24
- package/quaranteneProps.js +0 -37
- package/randomInt.js +0 -13
- package/randomKey.js +0 -15
- package/readCookie.js +0 -38
- package/removeAccents.js +0 -19
- package/removeCookie.js +0 -19
- package/removeDuplicates.js +0 -13
- package/removeDuplicatesByKey.js +0 -24
- package/removeDuplicatesComparing.js +0 -14
- package/removeIndexesFromArray.js +0 -18
- package/removeTrailingSlash.js +0 -14
- package/removeUrlQueryParams.js +0 -26
- package/render.js +0 -169
- package/roundTo.js +0 -38
- package/serializeCookie.js +0 -108
- package/setCookie.js +0 -62
- package/shuffle.js +0 -36
- package/slugify.js +0 -27
- package/split.js +0 -8
- package/swapMap.js +0 -18
- package/throttle.js +0 -30
- package/titleCase.js +0 -15
- package/toNumber.js +0 -12
- package/toRgba.js +0 -20
- package/transformToUrlPathname.js +0 -21
- package/truncate.js +0 -17
- package/tryUntil.js +0 -31
- package/types.js +0 -2
- package/uid.js +0 -16
- package/updateLinkParams.js +0 -19
- package/updateUrlQueryParams.js +0 -23
- package/uppercase.js +0 -13
- package/uuid.js +0 -17
- package/uuidNumeric.js +0 -10
- package/wait.js +0 -13
- package/without.js +0 -56
package/split.js
DELETED
package/swapMap.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.swapMap = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Swap object map key/value
|
|
6
|
-
*
|
|
7
|
-
* @category objects
|
|
8
|
-
*/
|
|
9
|
-
function swapMap(map) {
|
|
10
|
-
if (map === void 0) { map = {}; }
|
|
11
|
-
var output = {};
|
|
12
|
-
for (var key in map) {
|
|
13
|
-
output[map[key]] = key;
|
|
14
|
-
}
|
|
15
|
-
return output;
|
|
16
|
-
}
|
|
17
|
-
exports.swapMap = swapMap;
|
|
18
|
-
exports.default = swapMap;
|
package/throttle.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.throttle = void 0;
|
|
4
|
-
var tslib_1 = require("tslib");
|
|
5
|
-
/**
|
|
6
|
-
* Throttle function (e.g. for resize / scroll handlers)
|
|
7
|
-
*
|
|
8
|
-
* @category function
|
|
9
|
-
* @see https://github.com/Mobius1/Rangeable/
|
|
10
|
-
*/
|
|
11
|
-
function throttle(fn, limit, context) {
|
|
12
|
-
var wait;
|
|
13
|
-
return function () {
|
|
14
|
-
var args = [];
|
|
15
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
16
|
-
args[_i] = arguments[_i];
|
|
17
|
-
}
|
|
18
|
-
context = context || this;
|
|
19
|
-
if (!wait) {
|
|
20
|
-
fn.apply.apply(fn, tslib_1.__spreadArray([context], args, false));
|
|
21
|
-
wait = true;
|
|
22
|
-
return setTimeout(function () {
|
|
23
|
-
wait = false;
|
|
24
|
-
}, limit);
|
|
25
|
-
}
|
|
26
|
-
return;
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
exports.throttle = throttle;
|
|
30
|
-
exports.default = throttle;
|
package/titleCase.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.titleCase = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* @category typography
|
|
6
|
-
* @see https://github.com/blakeembrey/change-case/blob/master/packages/title-case/src/index.ts
|
|
7
|
-
* @author Blake Embrey (hello@blakeembrey.com)
|
|
8
|
-
*/
|
|
9
|
-
var titleCase = function (input) {
|
|
10
|
-
return input
|
|
11
|
-
? input.replace(/\w\S*/g, function (txt) { return txt.charAt(0).toUpperCase() + txt.substring(1).toLowerCase(); })
|
|
12
|
-
: "";
|
|
13
|
-
};
|
|
14
|
-
exports.titleCase = titleCase;
|
|
15
|
-
exports.default = exports.titleCase;
|
package/toNumber.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.toNumber = void 0;
|
|
4
|
-
var isNumber_1 = require("./isNumber");
|
|
5
|
-
/**
|
|
6
|
-
* @category cast
|
|
7
|
-
*/
|
|
8
|
-
function toNumber(input, fallback) {
|
|
9
|
-
return (0, isNumber_1.isNumber)(input) ? input : input ? parseFloat(input) : fallback || 0;
|
|
10
|
-
}
|
|
11
|
-
exports.toNumber = toNumber;
|
|
12
|
-
exports.default = toNumber;
|
package/toRgba.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// import hexRgb from "hex-rgb";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.toRgba = void 0;
|
|
5
|
-
// export const toRgb = (hexColor: string) => hexRgb(hexColor, { format: "css" });
|
|
6
|
-
// export const toRgba = (hexColor: string, alpha: number) =>
|
|
7
|
-
// hexRgb(hexColor, { format: "css", alpha });
|
|
8
|
-
/**
|
|
9
|
-
* @category colors
|
|
10
|
-
*/
|
|
11
|
-
function toRgba(hex, alpha) {
|
|
12
|
-
if (alpha === void 0) { alpha = 1; }
|
|
13
|
-
var r = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
|
14
|
-
if (r) {
|
|
15
|
-
return "rgba(".concat(parseInt(r[1], 16), ",").concat(parseInt(r[2], 16), ",").concat(parseInt(r[3], 16), ",").concat(alpha, ")");
|
|
16
|
-
}
|
|
17
|
-
return "";
|
|
18
|
-
}
|
|
19
|
-
exports.toRgba = toRgba;
|
|
20
|
-
exports.default = toRgba;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.transformToUrlPathname = void 0;
|
|
4
|
-
var tslib_1 = require("tslib");
|
|
5
|
-
var isString_1 = tslib_1.__importDefault(require("./isString"));
|
|
6
|
-
/**
|
|
7
|
-
* Transform string in a URL pathname (relative URL)
|
|
8
|
-
*
|
|
9
|
-
* - adds an initial slash
|
|
10
|
-
* - encode the string
|
|
11
|
-
* - replaces whitespaces with dashes
|
|
12
|
-
*
|
|
13
|
-
* @category location
|
|
14
|
-
*/
|
|
15
|
-
function transformToUrlPathname(toPathname) {
|
|
16
|
-
return (0, isString_1.default)(toPathname)
|
|
17
|
-
? "/".concat(encodeURIComponent(toPathname.replace(/\s/g, "-").toLowerCase()))
|
|
18
|
-
: "";
|
|
19
|
-
}
|
|
20
|
-
exports.transformToUrlPathname = transformToUrlPathname;
|
|
21
|
-
exports.default = transformToUrlPathname;
|
package/truncate.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.truncate = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Truncate string
|
|
6
|
-
*
|
|
7
|
-
* @category typography
|
|
8
|
-
*/
|
|
9
|
-
var truncate = function (input, length) {
|
|
10
|
-
return input
|
|
11
|
-
? input.length > length
|
|
12
|
-
? input.substring(0, length) + "..."
|
|
13
|
-
: input
|
|
14
|
-
: "";
|
|
15
|
-
};
|
|
16
|
-
exports.truncate = truncate;
|
|
17
|
-
exports.default = exports.truncate;
|
package/tryUntil.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.tryUntil = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* @borrows [https://levelup.gitconnected.com/javascript-wait-until-something-happens-or-timeout-82636839ea93]
|
|
6
|
-
*
|
|
7
|
-
* @param timeout in `ms`
|
|
8
|
-
* @param interval in `ms`
|
|
9
|
-
*/
|
|
10
|
-
var tryUntil = function (test, timeout, interval, resolve, reject) {
|
|
11
|
-
// return new Promise((resolve, reject) => {
|
|
12
|
-
var timeWas = new Date();
|
|
13
|
-
var wait = setInterval(function () {
|
|
14
|
-
if (test()) {
|
|
15
|
-
// console.log("resolved after", new Date() - timeWas, "ms");
|
|
16
|
-
clearInterval(wait);
|
|
17
|
-
resolve();
|
|
18
|
-
// @ts-expect-error ...
|
|
19
|
-
}
|
|
20
|
-
else if (new Date() - timeWas > timeout) {
|
|
21
|
-
// Timeout
|
|
22
|
-
// console.log("rejected after", new Date() - timeWas, "ms");
|
|
23
|
-
clearInterval(wait);
|
|
24
|
-
if (reject)
|
|
25
|
-
reject();
|
|
26
|
-
}
|
|
27
|
-
}, interval);
|
|
28
|
-
// });
|
|
29
|
-
};
|
|
30
|
-
exports.tryUntil = tryUntil;
|
|
31
|
-
exports.default = exports.tryUntil;
|
package/types.js
DELETED
package/uid.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.uid = void 0;
|
|
4
|
-
var lastId = 0;
|
|
5
|
-
/**
|
|
6
|
-
* Super basic UID increment-based generator
|
|
7
|
-
*
|
|
8
|
-
* @category uid
|
|
9
|
-
*/
|
|
10
|
-
var uid = function (prefix) {
|
|
11
|
-
if (prefix === void 0) { prefix = "id"; }
|
|
12
|
-
lastId++;
|
|
13
|
-
return "".concat(prefix, "-").concat(lastId);
|
|
14
|
-
};
|
|
15
|
-
exports.uid = uid;
|
|
16
|
-
exports.default = exports.uid;
|
package/updateLinkParams.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.updateLinkParams = void 0;
|
|
4
|
-
var tslib_1 = require("tslib");
|
|
5
|
-
var updateUrlQueryParams_1 = tslib_1.__importDefault(require("./updateUrlQueryParams"));
|
|
6
|
-
/**
|
|
7
|
-
* Update link `<a href="">` merging the given new query parameters.
|
|
8
|
-
* it returns the newly created `href` URL value
|
|
9
|
-
*
|
|
10
|
-
* @category location
|
|
11
|
-
* @pure
|
|
12
|
-
*/
|
|
13
|
-
function updateLinkParams($anchor, newParams) {
|
|
14
|
-
var href = (0, updateUrlQueryParams_1.default)($anchor.href, newParams);
|
|
15
|
-
$anchor.href = href;
|
|
16
|
-
return href;
|
|
17
|
-
}
|
|
18
|
-
exports.updateLinkParams = updateLinkParams;
|
|
19
|
-
exports.default = updateLinkParams;
|
package/updateUrlQueryParams.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.updateUrlQueryParams = void 0;
|
|
4
|
-
var tslib_1 = require("tslib");
|
|
5
|
-
var buildUrlQueryString_1 = tslib_1.__importDefault(require("./buildUrlQueryString"));
|
|
6
|
-
var getUrlQueryParams_1 = tslib_1.__importDefault(require("./getUrlQueryParams"));
|
|
7
|
-
var mergeUrlQueryParams_1 = tslib_1.__importDefault(require("./mergeUrlQueryParams"));
|
|
8
|
-
/**
|
|
9
|
-
* Update a URL string query parameters merging the given new query parameters
|
|
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);
|
|
21
|
-
}
|
|
22
|
-
exports.updateUrlQueryParams = updateUrlQueryParams;
|
|
23
|
-
exports.default = updateUrlQueryParams;
|
package/uppercase.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.uppercase = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Replacement for native `toUpperCase` tyescript ready (type narrowing ready)
|
|
6
|
-
*
|
|
7
|
-
* @category native
|
|
8
|
-
*/
|
|
9
|
-
var uppercase = function (str) {
|
|
10
|
-
return (str || "").toUpperCase();
|
|
11
|
-
};
|
|
12
|
-
exports.uppercase = uppercase;
|
|
13
|
-
exports.default = exports.uppercase;
|
package/uuid.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.uuid = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Uuid, tiny custom helper instead of node's uuid/v4
|
|
6
|
-
*
|
|
7
|
-
* @category uid
|
|
8
|
-
* @see https://stackoverflow.com/a/2117523/1938970
|
|
9
|
-
*/
|
|
10
|
-
var uuid = function () {
|
|
11
|
-
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) {
|
|
12
|
-
var r = (Math.random() * 16) | 0, v = c == "x" ? r : (r & 0x3) | 0x8;
|
|
13
|
-
return v.toString(16);
|
|
14
|
-
});
|
|
15
|
-
};
|
|
16
|
-
exports.uuid = uuid;
|
|
17
|
-
exports.default = exports.uuid;
|
package/uuidNumeric.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.uuidNumeric = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* @category uid
|
|
6
|
-
* @see https://stackoverflow.com/a/18048162/1938970
|
|
7
|
-
*/
|
|
8
|
-
var uuidNumeric = function () { return new Date().valueOf(); };
|
|
9
|
-
exports.uuidNumeric = uuidNumeric;
|
|
10
|
-
exports.default = exports.uuidNumeric;
|
package/wait.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.wait = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* A promisified `setTimeout`
|
|
6
|
-
*
|
|
7
|
-
* @category async
|
|
8
|
-
*/
|
|
9
|
-
var wait = function (milliseconds) {
|
|
10
|
-
return new Promise(function (resolve) { return setTimeout(resolve, milliseconds); });
|
|
11
|
-
};
|
|
12
|
-
exports.wait = wait;
|
|
13
|
-
exports.default = exports.wait;
|
package/without.js
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
3
|
-
// TODO: finish this up, this is not exported yet
|
|
4
|
-
// ready to copy-paste to https://www.typescriptlang.org/play
|
|
5
|
-
// type EmptyObject = Record<string, never>;
|
|
6
|
-
// type EmptyArray = never[];
|
|
7
|
-
// type EmptyString = "";
|
|
8
|
-
// type WithoutEmptyObject<T> = T extends EmptyObject ? never : T;
|
|
9
|
-
// type WithoutEmptyArray<T> = T extends EmptyArray ? never : T;
|
|
10
|
-
// type WithoutEmptyString<T> = T extends EmptyString ? never : T;
|
|
11
|
-
// type WithoutEmpty<T> = T extends EmptyObject | EmptyArray | EmptyString | null | undefined ? never : T;
|
|
12
|
-
// function withoutEmptyObject<T>(arg: WithoutEmptyObject<T>) {
|
|
13
|
-
// return arg;
|
|
14
|
-
// }
|
|
15
|
-
// function withoutEmptyArray<T>(arg: WithoutEmptyArray<T>) {
|
|
16
|
-
// return arg;
|
|
17
|
-
// }
|
|
18
|
-
// function withoutEmptyString<T>(arg: WithoutEmptyString<T>) {
|
|
19
|
-
// return arg;
|
|
20
|
-
// }
|
|
21
|
-
// function withoutEmpty<T>(arg: WithoutEmpty<T>) {
|
|
22
|
-
// return arg;
|
|
23
|
-
// }
|
|
24
|
-
// // @ts-expect-error
|
|
25
|
-
// const o1 = withoutEmptyObject({});
|
|
26
|
-
// // ^?
|
|
27
|
-
// const o2 = withoutEmptyObject({ accepted: 1 });
|
|
28
|
-
// // @ts-expect-error
|
|
29
|
-
// const a1 = withoutEmptyArray([]);
|
|
30
|
-
// // ^?
|
|
31
|
-
// const a2 = withoutEmptyArray(["accepted"]);
|
|
32
|
-
// // ^?
|
|
33
|
-
// const a3 = withoutEmptyArray("accepted");
|
|
34
|
-
// // ^?
|
|
35
|
-
// const a4 = withoutEmptyArray("accepted" === "accepted");
|
|
36
|
-
// // ^?
|
|
37
|
-
// // @ts-expect-error
|
|
38
|
-
// const s1 = withoutEmptyString("");
|
|
39
|
-
// // ^?
|
|
40
|
-
// const s2 = withoutEmptyString("accepted");
|
|
41
|
-
// // ^?
|
|
42
|
-
// // @ts-expect-error
|
|
43
|
-
// const w1 = withoutEmpty("");
|
|
44
|
-
// // ^?
|
|
45
|
-
// // @ts-expect-error
|
|
46
|
-
// const w2 = withoutEmpty(undefined);
|
|
47
|
-
// // ^?
|
|
48
|
-
// // @ts-expect-error
|
|
49
|
-
// const w3 = withoutEmpty(null);
|
|
50
|
-
// // ^?
|
|
51
|
-
// // @ts-expect-error
|
|
52
|
-
// const w4 = withoutEmpty({});
|
|
53
|
-
// // ^?
|
|
54
|
-
// // @ts-expect-error
|
|
55
|
-
// const w5 = withoutEmpty([]);
|
|
56
|
-
// // ^?
|