@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/ensureInt.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ensureInt = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Ensure input to be an integer
|
|
6
|
-
*
|
|
7
|
-
* @category cast
|
|
8
|
-
*/
|
|
9
|
-
var ensureInt = function (input) {
|
|
10
|
-
return typeof input === "string" ? parseInt(input, 10) : Math.round(input);
|
|
11
|
-
};
|
|
12
|
-
exports.ensureInt = ensureInt;
|
|
13
|
-
exports.default = exports.ensureInt;
|
package/env.js
DELETED
package/errorToString.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.errorToString = void 0;
|
|
4
|
-
var tslib_1 = require("tslib");
|
|
5
|
-
var isString_1 = tslib_1.__importDefault(require("./isString"));
|
|
6
|
-
/**
|
|
7
|
-
* Ensure to transform a JavaScript `Error` into a string (uses its `message`)
|
|
8
|
-
*
|
|
9
|
-
* @category Error
|
|
10
|
-
*/
|
|
11
|
-
var errorToString = function (e) {
|
|
12
|
-
return e instanceof Error ? e.message : (0, isString_1.default)(e) ? e : "";
|
|
13
|
-
};
|
|
14
|
-
exports.errorToString = errorToString;
|
|
15
|
-
exports.default = exports.errorToString;
|
package/findDuplicatedIndexes.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.findDuplicatedIndexes = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* @category array
|
|
6
|
-
*/
|
|
7
|
-
function findDuplicatedIndexes(arr) {
|
|
8
|
-
var indexes = {};
|
|
9
|
-
for (var i = 0; i < arr.length; i++) {
|
|
10
|
-
var idxInArray = arr.indexOf(arr[i]);
|
|
11
|
-
if (idxInArray !== i && idxInArray !== -1) {
|
|
12
|
-
indexes[i] = true;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
return indexes;
|
|
16
|
-
}
|
|
17
|
-
exports.findDuplicatedIndexes = findDuplicatedIndexes;
|
|
18
|
-
exports.default = findDuplicatedIndexes;
|
package/forin.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.forin = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* To easily get typed native `for in`
|
|
6
|
-
*
|
|
7
|
-
* @category objects
|
|
8
|
-
*/
|
|
9
|
-
function forin(object, cb) {
|
|
10
|
-
for (var key in object) {
|
|
11
|
-
cb(key, object[key]);
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
exports.forin = forin;
|
|
15
|
-
exports.default = forin;
|
package/gbToBytes.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.gbToBytes = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Gigabytes to bytes
|
|
6
|
-
*
|
|
7
|
-
* @category format
|
|
8
|
-
*/
|
|
9
|
-
var gbToBytes = function (bytes) { return bytes * 1000 * 1000 * 1000; };
|
|
10
|
-
exports.gbToBytes = gbToBytes;
|
|
11
|
-
exports.default = exports.gbToBytes;
|
package/getEmptyArray.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
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"));
|
|
6
|
-
/**
|
|
7
|
-
*
|
|
8
|
-
* Returns an array of undefined values of the desired length, useful to build
|
|
9
|
-
* skeleton UIs.
|
|
10
|
-
*
|
|
11
|
-
* @category array
|
|
12
|
-
*/
|
|
13
|
-
function getEmptyArray /* <T extends undefined | null = undefined> */(length) {
|
|
14
|
-
if (!(0, isNumber_1.default)(length)) {
|
|
15
|
-
length = parseInt(length, 10);
|
|
16
|
-
}
|
|
17
|
-
return Array.from({ length: length });
|
|
18
|
-
}
|
|
19
|
-
exports.getEmptyArray = getEmptyArray;
|
|
20
|
-
exports.default = getEmptyArray;
|
package/getKeys.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getKeys = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Type safe replacement for `Object.keys(myObject)` to iterate over a record
|
|
6
|
-
* without loosing the key's types in simple `string`s.
|
|
7
|
-
*
|
|
8
|
-
* @category objects
|
|
9
|
-
* @see https://stackoverflow.com/a/59459000/1938970
|
|
10
|
-
*/
|
|
11
|
-
exports.getKeys = Object.keys;
|
|
12
|
-
exports.default = exports.getKeys;
|
|
@@ -1,72 +0,0 @@
|
|
|
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);
|
|
7
|
-
var sortedBreakpointsNames = Object.keys(breakpoints).map(function (key) {
|
|
8
|
-
var br = key;
|
|
9
|
-
return [br, breakpoints[br]];
|
|
10
|
-
})
|
|
11
|
-
.sort(function (a, b) { return a[1] - b[1]; })
|
|
12
|
-
.map(function (item) { return item[0]; });
|
|
13
|
-
var getNextBreakpoint = function (breakpoint) {
|
|
14
|
-
var index = sortedBreakpointsNames.indexOf(breakpoint);
|
|
15
|
-
return sortedBreakpointsNames[index + 1];
|
|
16
|
-
};
|
|
17
|
-
/**
|
|
18
|
-
* It behaves the same as `(min-width: ${value}px)`
|
|
19
|
-
* where value is the given breakpoint value.
|
|
20
|
-
* For ease of use this can be used both as a function `min("md")` and as an
|
|
21
|
-
* object literal `min.md`.
|
|
22
|
-
*/
|
|
23
|
-
var min = function (br) { return "(min-width: ".concat(breakpoints[br], "px)"); };
|
|
24
|
-
/**
|
|
25
|
-
* It behaves the same as `(max-width: ${value}px)`
|
|
26
|
-
* where value is the given breakpoint value.
|
|
27
|
-
* For ease of use this can be used both as a function `max("md")` and as an
|
|
28
|
-
* object literal `max.md`.
|
|
29
|
-
*/
|
|
30
|
-
var max = function (br) { return "(max-width: ".concat(breakpoints[br] - 0.02, "px)"); };
|
|
31
|
-
/**
|
|
32
|
-
* It behaves the same as `min`
|
|
33
|
-
* @inheritdoc {max}
|
|
34
|
-
*/
|
|
35
|
-
var up = min;
|
|
36
|
-
/**
|
|
37
|
-
* It behaves similarly to `max` but you will use the "next" breakpoint,
|
|
38
|
-
* specifying CSS that will apply from the given breakpoint and down.
|
|
39
|
-
*/
|
|
40
|
-
var down = function (br) {
|
|
41
|
-
var brNext = getNextBreakpoint(br);
|
|
42
|
-
// TODO: if br does not exists otherwise throw Error
|
|
43
|
-
return brNext && "(max-width: ".concat(breakpoints[brNext] - 0.02, "px)");
|
|
44
|
-
};
|
|
45
|
-
/**
|
|
46
|
-
* Media query between the two given breakpoints
|
|
47
|
-
*/
|
|
48
|
-
var between = function (br1, br2) {
|
|
49
|
-
br2 = br2 || getNextBreakpoint(br1);
|
|
50
|
-
return br2
|
|
51
|
-
? "(min-width: ".concat(breakpoints[br1], "px) and (max-width: ").concat(breakpoints[br2] - 0.02, "px)")
|
|
52
|
-
: min(br1);
|
|
53
|
-
};
|
|
54
|
-
/**
|
|
55
|
-
* Media query to apply from the given breakpoint until the next, just for its
|
|
56
|
-
* full range
|
|
57
|
-
*/
|
|
58
|
-
var only = function (br) {
|
|
59
|
-
var brNext = getNextBreakpoint(br);
|
|
60
|
-
return brNext ? between(br, brNext) : min(br);
|
|
61
|
-
};
|
|
62
|
-
return {
|
|
63
|
-
max: max,
|
|
64
|
-
min: min,
|
|
65
|
-
down: down,
|
|
66
|
-
up: up,
|
|
67
|
-
between: between,
|
|
68
|
-
only: only,
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
exports.getMediaQueryWidthResolvers = getMediaQueryWidthResolvers;
|
|
72
|
-
exports.default = getMediaQueryWidthResolvers;
|
|
@@ -1,33 +0,0 @@
|
|
|
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);
|
|
7
|
-
// Object.keys(breakpoints).reduce((screens, br) => {
|
|
8
|
-
var screens = Object.keys(breakpoints).reduce(function (output, br, idx) {
|
|
9
|
-
var brNext = Object.keys(breakpoints)[idx + 1];
|
|
10
|
-
for (var resolverName in mqWidthResolvers) {
|
|
11
|
-
// this line is just for typescript..
|
|
12
|
-
var resolver = resolverName;
|
|
13
|
-
var resolverFn = mqWidthResolvers[resolver];
|
|
14
|
-
var raw = resolverFn(br);
|
|
15
|
-
if (raw) {
|
|
16
|
-
if (resolverName === "min") {
|
|
17
|
-
output["@".concat(br)] = { raw: raw };
|
|
18
|
-
}
|
|
19
|
-
if (resolverName === "between") {
|
|
20
|
-
if (brNext)
|
|
21
|
-
output["@".concat(resolverName, "-").concat(br, "_").concat(brNext)] = { raw: raw };
|
|
22
|
-
}
|
|
23
|
-
else {
|
|
24
|
-
output["@".concat(resolverName, "-").concat(br)] = { raw: raw };
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
return output;
|
|
29
|
-
}, {});
|
|
30
|
-
return screens;
|
|
31
|
-
}
|
|
32
|
-
exports.getMediaQueryWidthTailwindScreens = getMediaQueryWidthTailwindScreens;
|
|
33
|
-
exports.default = getMediaQueryWidthTailwindScreens;
|
package/getNonce.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getNonce = void 0;
|
|
4
|
-
var isUndefined_1 = require("./isUndefined");
|
|
5
|
-
/**
|
|
6
|
-
* @category security
|
|
7
|
-
* @see https://github.com/styled-components/styled-components/blob/main/packages/styled-components/src/utils/nonce.ts
|
|
8
|
-
*/
|
|
9
|
-
function getNonce() {
|
|
10
|
-
return (0, isUndefined_1.isUndefined)(__webpack_nonce__) ? null : __webpack_nonce__;
|
|
11
|
-
}
|
|
12
|
-
exports.getNonce = getNonce;
|
|
13
|
-
exports.default = getNonce;
|
package/getParamAmong.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
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"));
|
|
6
|
-
/**
|
|
7
|
-
* Get query parameter as `string` treating the `ParsedUrlQuery` result of
|
|
8
|
-
* [`querystring`](https://nodejs.org/api/querystring.html) (used in next.js
|
|
9
|
-
* router and elsewhere)
|
|
10
|
-
*
|
|
11
|
-
* @category location
|
|
12
|
-
*
|
|
13
|
-
* @param {string} [raw] - The _raw_ query parameter
|
|
14
|
-
* @param {string[]} [allowedValues=[]] - The list of values (as strings) that the parameter can have, if not one of them `null` is returned
|
|
15
|
-
*/
|
|
16
|
-
function getParamAmong(raw, allowedValues) {
|
|
17
|
-
if (allowedValues === void 0) { allowedValues = []; }
|
|
18
|
-
var string = (0, getParamAsString_1.default)(raw);
|
|
19
|
-
return allowedValues.includes(string) ? string : null;
|
|
20
|
-
}
|
|
21
|
-
exports.getParamAmong = getParamAmong;
|
|
22
|
-
exports.default = getParamAmong;
|
package/getParamAsInt.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getParamAsInt = void 0;
|
|
4
|
-
var tslib_1 = require("tslib");
|
|
5
|
-
var getParamAsString_1 = tslib_1.__importDefault(require("./getParamAsString"));
|
|
6
|
-
/**
|
|
7
|
-
* Get query parameter as `int`eger treating the `ParsedUrlQuery` result of
|
|
8
|
-
* [`querystring`](https://nodejs.org/api/querystring.html) (used in next.js
|
|
9
|
-
* router and elsewhere)
|
|
10
|
-
*
|
|
11
|
-
* @category location
|
|
12
|
-
*
|
|
13
|
-
* @param {string} [raw] - The _raw_ query parameter
|
|
14
|
-
* @param {number} [fallback] - Fallback number, we return `null` if not provided
|
|
15
|
-
*/
|
|
16
|
-
function getParamAsInt(raw, fallback) {
|
|
17
|
-
if (fallback === void 0) { fallback = null; }
|
|
18
|
-
var string = (0, getParamAsString_1.default)(raw);
|
|
19
|
-
if (string) {
|
|
20
|
-
return parseInt(string, 10);
|
|
21
|
-
}
|
|
22
|
-
return fallback;
|
|
23
|
-
}
|
|
24
|
-
exports.getParamAsInt = getParamAsInt;
|
|
25
|
-
exports.default = getParamAsInt;
|
package/getParamAsString.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getParamAsString = void 0;
|
|
4
|
-
var tslib_1 = require("tslib");
|
|
5
|
-
var isArray_1 = tslib_1.__importDefault(require("./isArray"));
|
|
6
|
-
/**
|
|
7
|
-
* Get query parameter as `string` treating the `ParsedUrlQuery` result of
|
|
8
|
-
* [`querystring`](https://nodejs.org/api/querystring.html) (used in next.js
|
|
9
|
-
* router and elsewhere)
|
|
10
|
-
*
|
|
11
|
-
* @category location
|
|
12
|
-
*
|
|
13
|
-
* @param {string} [raw] - The _raw_ query parameter
|
|
14
|
-
*/
|
|
15
|
-
function getParamAsString(raw) {
|
|
16
|
-
return ((0, isArray_1.default)(raw) ? raw[0] : raw) || "";
|
|
17
|
-
}
|
|
18
|
-
exports.getParamAsString = getParamAsString;
|
|
19
|
-
exports.default = getParamAsString;
|
package/getType.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* @file
|
|
4
|
-
*
|
|
5
|
-
* Same as [is-what](https://github.com/mesqueeb/is-what) plus:
|
|
6
|
-
*
|
|
7
|
-
* - `isFormData`
|
|
8
|
-
* - `isInt`
|
|
9
|
-
* - `isFloat`
|
|
10
|
-
*/
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.getType = void 0;
|
|
13
|
-
/**
|
|
14
|
-
* Returns the object type of the given payload
|
|
15
|
-
*
|
|
16
|
-
* @param {*} payload
|
|
17
|
-
* @returns {string}
|
|
18
|
-
*/
|
|
19
|
-
function getType(payload) {
|
|
20
|
-
return Object.prototype.toString.call(payload).slice(8, -1);
|
|
21
|
-
}
|
|
22
|
-
exports.getType = getType;
|
|
23
|
-
exports.default = getType;
|
package/getUrlHashParams.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getUrlHashParams = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* It returns the "query params" as an object extracting it from the given `hash`
|
|
6
|
-
* string or, if not provided, failling back reading the `location.hash`
|
|
7
|
-
*
|
|
8
|
-
* @category location
|
|
9
|
-
*/
|
|
10
|
-
function getUrlHashParams(hash) {
|
|
11
|
-
if (hash === void 0) { hash = ""; }
|
|
12
|
-
hash = hash || location.hash;
|
|
13
|
-
var hashParts = hash.split("?");
|
|
14
|
-
if (hashParts.length >= 1) {
|
|
15
|
-
return Object.fromEntries(new URLSearchParams(hashParts[1]));
|
|
16
|
-
}
|
|
17
|
-
return {};
|
|
18
|
-
}
|
|
19
|
-
exports.getUrlHashParams = getUrlHashParams;
|
|
20
|
-
exports.default = getUrlHashParams;
|
package/getUrlHashPathname.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getUrlHashPathname = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* It returns the "pathname" cleaned up from the `#` and the initial slashes
|
|
6
|
-
* extracting it from the given `hash` string or, if not provided, failling
|
|
7
|
-
* back reading the `location.hash`
|
|
8
|
-
*
|
|
9
|
-
* @category location
|
|
10
|
-
*/
|
|
11
|
-
function getUrlHashPathname(hash) {
|
|
12
|
-
if (hash === void 0) { hash = ""; }
|
|
13
|
-
hash = hash || location.hash;
|
|
14
|
-
return hash.split("?")[0].replace(/^#\//, "");
|
|
15
|
-
}
|
|
16
|
-
exports.getUrlHashPathname = getUrlHashPathname;
|
|
17
|
-
exports.default = getUrlHashPathname;
|
package/getUrlPathnameParts.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getUrlPathnameParts = void 0;
|
|
4
|
-
var tslib_1 = require("tslib");
|
|
5
|
-
var isBrowser_1 = tslib_1.__importDefault(require("./isBrowser"));
|
|
6
|
-
/**
|
|
7
|
-
* Get pathname parts
|
|
8
|
-
*
|
|
9
|
-
* First clean the pathname from the first slash if any then split the pathname
|
|
10
|
-
* in parts,
|
|
11
|
-
* Given a pathname like: `"/en/{prefix}/{collection}/{slug}"` we obtain
|
|
12
|
-
* `[locale, prefix, collection, slug]`
|
|
13
|
-
*
|
|
14
|
-
* @category location
|
|
15
|
-
*/
|
|
16
|
-
function getUrlPathnameParts(pathname) {
|
|
17
|
-
if (pathname === void 0) { pathname = ""; }
|
|
18
|
-
pathname = pathname || isBrowser_1.default ? location.pathname : "";
|
|
19
|
-
return pathname
|
|
20
|
-
.replace(/^\//, "")
|
|
21
|
-
.split("/")
|
|
22
|
-
.filter(function (part) { return part; });
|
|
23
|
-
}
|
|
24
|
-
exports.getUrlPathnameParts = getUrlPathnameParts;
|
|
25
|
-
exports.default = getUrlPathnameParts;
|
package/getUrlQueryParams.js
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getUrlQueryParams = void 0;
|
|
4
|
-
var tslib_1 = require("tslib");
|
|
5
|
-
var isBrowser_1 = tslib_1.__importDefault(require("./isBrowser"));
|
|
6
|
-
/**
|
|
7
|
-
* Get parsed query parameters as object dictionary (from URL or given query string)
|
|
8
|
-
*
|
|
9
|
-
* @category location
|
|
10
|
-
* @param url A URL which contains a `?`, e.g. `?myparam=x` or `https://a.com?myparams=x`.
|
|
11
|
-
* If not provided it defaults reading the current URL query string with
|
|
12
|
-
* `location.search`. Through this argument you can use this
|
|
13
|
-
* same function to parse, for instance, the query params of
|
|
14
|
-
* the `href` of a `<a href="...">` HTML tag.
|
|
15
|
-
*
|
|
16
|
-
*/
|
|
17
|
-
function getUrlQueryParams(url) {
|
|
18
|
-
var _a;
|
|
19
|
-
var params = {};
|
|
20
|
-
var search = url
|
|
21
|
-
? (_a = url.split("?")) === null || _a === void 0 ? void 0 : _a[1]
|
|
22
|
-
: isBrowser_1.default
|
|
23
|
-
? location.search.substring(1)
|
|
24
|
-
: "";
|
|
25
|
-
if (!search) {
|
|
26
|
-
return {};
|
|
27
|
-
}
|
|
28
|
-
try {
|
|
29
|
-
// @see https://stackoverflow.com/a/8649003/1938970
|
|
30
|
-
var paramsAsObj = "{\"".concat(search
|
|
31
|
-
.replace(/&/g, '","')
|
|
32
|
-
.replace(/=/g, '":"'), "\"}");
|
|
33
|
-
params = JSON.parse(paramsAsObj, function (key, value) {
|
|
34
|
-
return key === "" ? value : decodeURIComponent(value);
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
catch (e) {
|
|
38
|
-
// do nothing or warn on process.env["NODE_ENV"] !== "production"
|
|
39
|
-
}
|
|
40
|
-
return params;
|
|
41
|
-
}
|
|
42
|
-
exports.getUrlQueryParams = getUrlQueryParams;
|
|
43
|
-
exports.default = getUrlQueryParams;
|
package/imgEmptyPixel.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.imgEmptyPixel = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Empty img pixel as a string to inline
|
|
6
|
-
*
|
|
7
|
-
* @category img
|
|
8
|
-
*/
|
|
9
|
-
exports.imgEmptyPixel = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=";
|
|
10
|
-
exports.default = exports.imgEmptyPixel;
|