@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/mapListBy.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mapListBy = void 0;
|
|
1
4
|
/**
|
|
2
5
|
* Maps an array of objects into a map keyed with the given key
|
|
3
6
|
*
|
|
4
7
|
* @category array
|
|
5
8
|
*/
|
|
6
|
-
|
|
9
|
+
function mapListBy(array, key) {
|
|
7
10
|
if (array === void 0) { array = []; }
|
|
8
11
|
if (key === void 0) { key = ""; }
|
|
9
12
|
return array.reduce(function (obj, item) {
|
|
@@ -11,4 +14,5 @@ export function mapListBy(array, key) {
|
|
|
11
14
|
return obj;
|
|
12
15
|
}, {});
|
|
13
16
|
}
|
|
14
|
-
|
|
17
|
+
exports.mapListBy = mapListBy;
|
|
18
|
+
exports.default = mapListBy;
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.mapListBy = void 0;
|
|
4
1
|
/**
|
|
5
2
|
* Maps an array of objects into a map keyed with the given key
|
|
6
3
|
*
|
|
7
4
|
* @category array
|
|
8
5
|
*/
|
|
9
|
-
function mapListBy(array, key) {
|
|
6
|
+
export function mapListBy(array, key) {
|
|
10
7
|
if (array === void 0) { array = []; }
|
|
11
8
|
if (key === void 0) { key = ""; }
|
|
12
9
|
return array.reduce(function (obj, item) {
|
|
@@ -14,5 +11,4 @@ function mapListBy(array, key) {
|
|
|
14
11
|
return obj;
|
|
15
12
|
}, {});
|
|
16
13
|
}
|
|
17
|
-
|
|
18
|
-
exports.default = mapListBy;
|
|
14
|
+
export default mapListBy;
|
package/matchSorter.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.defaultBaseSortFn = exports.matchSorter = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
2
5
|
/**
|
|
3
6
|
* @file
|
|
4
7
|
*
|
|
@@ -15,7 +18,7 @@ import { __assign } from "tslib";
|
|
|
15
18
|
* @copyright (c) 2020 Kent C. Dodds
|
|
16
19
|
* @author Kent C. Dodds <me@kentcdodds.com> (https://kentcdodds.com)
|
|
17
20
|
*/
|
|
18
|
-
|
|
21
|
+
var removeAccents_1 = tslib_1.__importDefault(require("./removeAccents"));
|
|
19
22
|
var RANKING_CASE_SENSITIVE_EQUAL = 7;
|
|
20
23
|
var RANKING_EQUAL = 6;
|
|
21
24
|
var RANKING_STARTS_WITH = 5;
|
|
@@ -27,6 +30,7 @@ var RANKING_NO_MATCH = 0;
|
|
|
27
30
|
var defaultBaseSortFn = function (a, b) {
|
|
28
31
|
return String(a.rankedValue).localeCompare(String(b.rankedValue));
|
|
29
32
|
};
|
|
33
|
+
exports.defaultBaseSortFn = defaultBaseSortFn;
|
|
30
34
|
/**
|
|
31
35
|
* Takes an array of items and a value and returns a new array with the items that match the given value
|
|
32
36
|
* @param {Array} items - the items to sort
|
|
@@ -48,11 +52,12 @@ function matchSorter(items, value, options) {
|
|
|
48
52
|
var rankingInfo = getHighestRanking(item, keys, value, options);
|
|
49
53
|
var rank = rankingInfo.rank, _a = rankingInfo.keyThreshold, keyThreshold = _a === void 0 ? threshold : _a;
|
|
50
54
|
if (rank >= keyThreshold) {
|
|
51
|
-
matches.push(__assign(__assign({}, rankingInfo), { item: item, index: index }));
|
|
55
|
+
matches.push(tslib_1.__assign(tslib_1.__assign({}, rankingInfo), { item: item, index: index }));
|
|
52
56
|
}
|
|
53
57
|
return matches;
|
|
54
58
|
}
|
|
55
59
|
}
|
|
60
|
+
exports.matchSorter = matchSorter;
|
|
56
61
|
/**
|
|
57
62
|
* Gets the highest ranking for value for the given item based on its values for the given keys
|
|
58
63
|
* @param {*} item - the item to rank
|
|
@@ -250,7 +255,7 @@ function prepareValueForComparison(value, _a) {
|
|
|
250
255
|
// so part of preparing the value for comparison is ensure that it is a string
|
|
251
256
|
value = "".concat(value); // toString
|
|
252
257
|
if (!keepDiacritics) {
|
|
253
|
-
value =
|
|
258
|
+
value = (0, removeAccents_1.default)(value);
|
|
254
259
|
}
|
|
255
260
|
return value;
|
|
256
261
|
}
|
|
@@ -364,7 +369,6 @@ function getKeyAttributes(key) {
|
|
|
364
369
|
if (typeof key === "string") {
|
|
365
370
|
return defaultKeyAttributes;
|
|
366
371
|
}
|
|
367
|
-
return __assign(__assign({}, defaultKeyAttributes), key);
|
|
372
|
+
return tslib_1.__assign(tslib_1.__assign({}, defaultKeyAttributes), key);
|
|
368
373
|
}
|
|
369
|
-
|
|
370
|
-
export default matchSorter;
|
|
374
|
+
exports.default = matchSorter;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.defaultBaseSortFn = exports.matchSorter = void 0;
|
|
4
|
-
var tslib_1 = require("tslib");
|
|
1
|
+
import { __assign } from "tslib";
|
|
5
2
|
/**
|
|
6
3
|
* @file
|
|
7
4
|
*
|
|
@@ -18,7 +15,7 @@ var tslib_1 = require("tslib");
|
|
|
18
15
|
* @copyright (c) 2020 Kent C. Dodds
|
|
19
16
|
* @author Kent C. Dodds <me@kentcdodds.com> (https://kentcdodds.com)
|
|
20
17
|
*/
|
|
21
|
-
|
|
18
|
+
import removeAccents from "./removeAccents";
|
|
22
19
|
var RANKING_CASE_SENSITIVE_EQUAL = 7;
|
|
23
20
|
var RANKING_EQUAL = 6;
|
|
24
21
|
var RANKING_STARTS_WITH = 5;
|
|
@@ -30,7 +27,6 @@ var RANKING_NO_MATCH = 0;
|
|
|
30
27
|
var defaultBaseSortFn = function (a, b) {
|
|
31
28
|
return String(a.rankedValue).localeCompare(String(b.rankedValue));
|
|
32
29
|
};
|
|
33
|
-
exports.defaultBaseSortFn = defaultBaseSortFn;
|
|
34
30
|
/**
|
|
35
31
|
* Takes an array of items and a value and returns a new array with the items that match the given value
|
|
36
32
|
* @param {Array} items - the items to sort
|
|
@@ -52,12 +48,11 @@ function matchSorter(items, value, options) {
|
|
|
52
48
|
var rankingInfo = getHighestRanking(item, keys, value, options);
|
|
53
49
|
var rank = rankingInfo.rank, _a = rankingInfo.keyThreshold, keyThreshold = _a === void 0 ? threshold : _a;
|
|
54
50
|
if (rank >= keyThreshold) {
|
|
55
|
-
matches.push(
|
|
51
|
+
matches.push(__assign(__assign({}, rankingInfo), { item: item, index: index }));
|
|
56
52
|
}
|
|
57
53
|
return matches;
|
|
58
54
|
}
|
|
59
55
|
}
|
|
60
|
-
exports.matchSorter = matchSorter;
|
|
61
56
|
/**
|
|
62
57
|
* Gets the highest ranking for value for the given item based on its values for the given keys
|
|
63
58
|
* @param {*} item - the item to rank
|
|
@@ -255,7 +250,7 @@ function prepareValueForComparison(value, _a) {
|
|
|
255
250
|
// so part of preparing the value for comparison is ensure that it is a string
|
|
256
251
|
value = "".concat(value); // toString
|
|
257
252
|
if (!keepDiacritics) {
|
|
258
|
-
value = (
|
|
253
|
+
value = removeAccents(value);
|
|
259
254
|
}
|
|
260
255
|
return value;
|
|
261
256
|
}
|
|
@@ -369,6 +364,7 @@ function getKeyAttributes(key) {
|
|
|
369
364
|
if (typeof key === "string") {
|
|
370
365
|
return defaultKeyAttributes;
|
|
371
366
|
}
|
|
372
|
-
return
|
|
367
|
+
return __assign(__assign({}, defaultKeyAttributes), key);
|
|
373
368
|
}
|
|
374
|
-
|
|
369
|
+
export { matchSorter, defaultBaseSortFn };
|
|
370
|
+
export default matchSorter;
|
package/mbToBytes.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mbToBytes = void 0;
|
|
1
4
|
/**
|
|
2
5
|
* Megabytes to bytes
|
|
3
6
|
*
|
|
4
7
|
* @category format
|
|
5
8
|
*/
|
|
6
|
-
|
|
7
|
-
|
|
9
|
+
var mbToBytes = function (bytes) { return bytes * 1000 * 1000; };
|
|
10
|
+
exports.mbToBytes = mbToBytes;
|
|
11
|
+
exports.default = exports.mbToBytes;
|
package/mbToBytes.mjs
ADDED
package/mergeObjects.js
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mergeObjects = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var isObject_1 = require("./isObject");
|
|
3
6
|
/**
|
|
4
7
|
* Merge two or more objects together. It mutates the target object.
|
|
5
8
|
*
|
|
6
9
|
* @category objects
|
|
7
10
|
* @see https://stackoverflow.com/a/46973278/1938970
|
|
8
11
|
*/
|
|
9
|
-
|
|
12
|
+
var mergeObjects = function (target) {
|
|
10
13
|
var sources = [];
|
|
11
14
|
for (var _i = 1; _i < arguments.length; _i++) {
|
|
12
15
|
sources[_i - 1] = arguments[_i];
|
|
@@ -18,20 +21,21 @@ export var mergeObjects = function (target) {
|
|
|
18
21
|
if (source === undefined) {
|
|
19
22
|
return target;
|
|
20
23
|
}
|
|
21
|
-
if (isObject(target) && isObject(source)) {
|
|
24
|
+
if ((0, isObject_1.isObject)(target) && (0, isObject_1.isObject)(source)) {
|
|
22
25
|
Object.keys(source).forEach(function (_key) {
|
|
23
26
|
var key = _key;
|
|
24
|
-
if (isObject(source[key])) {
|
|
27
|
+
if ((0, isObject_1.isObject)(source[key])) {
|
|
25
28
|
if (!target[key]) {
|
|
26
29
|
// @ts-expect-error FIXME: ...
|
|
27
30
|
target[key] = {};
|
|
28
31
|
}
|
|
29
|
-
mergeObjects(target[key], source[key]);
|
|
32
|
+
(0, exports.mergeObjects)(target[key], source[key]);
|
|
30
33
|
}
|
|
31
34
|
else {
|
|
32
35
|
target[key] = source[key];
|
|
33
36
|
}
|
|
34
37
|
});
|
|
35
38
|
}
|
|
36
|
-
return mergeObjects.apply(void 0, __spreadArray([target], sources, false));
|
|
39
|
+
return exports.mergeObjects.apply(void 0, tslib_1.__spreadArray([target], sources, false));
|
|
37
40
|
};
|
|
41
|
+
exports.mergeObjects = mergeObjects;
|
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.mergeObjects = void 0;
|
|
4
|
-
var tslib_1 = require("tslib");
|
|
5
|
-
var isObject_1 = require("./isObject");
|
|
1
|
+
import { __spreadArray } from "tslib";
|
|
2
|
+
import { isObject } from "./isObject";
|
|
6
3
|
/**
|
|
7
4
|
* Merge two or more objects together. It mutates the target object.
|
|
8
5
|
*
|
|
9
6
|
* @category objects
|
|
10
7
|
* @see https://stackoverflow.com/a/46973278/1938970
|
|
11
8
|
*/
|
|
12
|
-
var mergeObjects = function (target) {
|
|
9
|
+
export var mergeObjects = function (target) {
|
|
13
10
|
var sources = [];
|
|
14
11
|
for (var _i = 1; _i < arguments.length; _i++) {
|
|
15
12
|
sources[_i - 1] = arguments[_i];
|
|
@@ -21,21 +18,20 @@ var mergeObjects = function (target) {
|
|
|
21
18
|
if (source === undefined) {
|
|
22
19
|
return target;
|
|
23
20
|
}
|
|
24
|
-
if (
|
|
21
|
+
if (isObject(target) && isObject(source)) {
|
|
25
22
|
Object.keys(source).forEach(function (_key) {
|
|
26
23
|
var key = _key;
|
|
27
|
-
if (
|
|
24
|
+
if (isObject(source[key])) {
|
|
28
25
|
if (!target[key]) {
|
|
29
26
|
// @ts-expect-error FIXME: ...
|
|
30
27
|
target[key] = {};
|
|
31
28
|
}
|
|
32
|
-
|
|
29
|
+
mergeObjects(target[key], source[key]);
|
|
33
30
|
}
|
|
34
31
|
else {
|
|
35
32
|
target[key] = source[key];
|
|
36
33
|
}
|
|
37
34
|
});
|
|
38
35
|
}
|
|
39
|
-
return
|
|
36
|
+
return mergeObjects.apply(void 0, __spreadArray([target], sources, false));
|
|
40
37
|
};
|
|
41
|
-
exports.mergeObjects = mergeObjects;
|
package/mergeUrlQueryParams.js
CHANGED
|
@@ -1,16 +1,20 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mergeUrlQueryParams = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var isNull_1 = tslib_1.__importDefault(require("./isNull"));
|
|
2
6
|
/**
|
|
3
7
|
* Merge query parameters objects, it *mutates* the first given object argument
|
|
4
8
|
*
|
|
5
9
|
* @category location
|
|
6
10
|
* @pure
|
|
7
11
|
*/
|
|
8
|
-
|
|
12
|
+
function mergeUrlQueryParams(oldParams, newParams) {
|
|
9
13
|
if (oldParams === void 0) { oldParams = {}; }
|
|
10
14
|
if (newParams === void 0) { newParams = {}; }
|
|
11
15
|
for (var key in newParams) {
|
|
12
16
|
var value = newParams[key];
|
|
13
|
-
if (oldParams[key] &&
|
|
17
|
+
if (oldParams[key] && (0, isNull_1.default)(value)) {
|
|
14
18
|
delete oldParams[key];
|
|
15
19
|
}
|
|
16
20
|
else {
|
|
@@ -19,4 +23,5 @@ export function mergeUrlQueryParams(oldParams, newParams) {
|
|
|
19
23
|
}
|
|
20
24
|
return oldParams;
|
|
21
25
|
}
|
|
22
|
-
|
|
26
|
+
exports.mergeUrlQueryParams = mergeUrlQueryParams;
|
|
27
|
+
exports.default = mergeUrlQueryParams;
|
|
@@ -1,20 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.mergeUrlQueryParams = void 0;
|
|
4
|
-
var tslib_1 = require("tslib");
|
|
5
|
-
var isNull_1 = tslib_1.__importDefault(require("./isNull"));
|
|
1
|
+
import isNull from "./isNull";
|
|
6
2
|
/**
|
|
7
3
|
* Merge query parameters objects, it *mutates* the first given object argument
|
|
8
4
|
*
|
|
9
5
|
* @category location
|
|
10
6
|
* @pure
|
|
11
7
|
*/
|
|
12
|
-
function mergeUrlQueryParams(oldParams, newParams) {
|
|
8
|
+
export function mergeUrlQueryParams(oldParams, newParams) {
|
|
13
9
|
if (oldParams === void 0) { oldParams = {}; }
|
|
14
10
|
if (newParams === void 0) { newParams = {}; }
|
|
15
11
|
for (var key in newParams) {
|
|
16
12
|
var value = newParams[key];
|
|
17
|
-
if (oldParams[key] && (
|
|
13
|
+
if (oldParams[key] && isNull(value)) {
|
|
18
14
|
delete oldParams[key];
|
|
19
15
|
}
|
|
20
16
|
else {
|
|
@@ -23,5 +19,4 @@ function mergeUrlQueryParams(oldParams, newParams) {
|
|
|
23
19
|
}
|
|
24
20
|
return oldParams;
|
|
25
21
|
}
|
|
26
|
-
|
|
27
|
-
exports.default = mergeUrlQueryParams;
|
|
22
|
+
export default mergeUrlQueryParams;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.moveSortableArrayItemByKey = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
2
5
|
/**
|
|
3
6
|
* Move item from one place to another in a sortable array of objects, re-ordering
|
|
4
7
|
* the array accrodingly (no swapping of position).
|
|
@@ -6,12 +9,13 @@ import { __spreadArray } from "tslib";
|
|
|
6
9
|
*
|
|
7
10
|
* @category arrays, dnd
|
|
8
11
|
*/
|
|
9
|
-
|
|
12
|
+
function moveSortableArrayItemByKey(items, key, fromItem, toItem) {
|
|
10
13
|
var itemsKeys = items.map(function (item) { return item[key]; });
|
|
11
14
|
var idxFrom = itemsKeys.indexOf(fromItem[key]);
|
|
12
15
|
var idxTo = itemsKeys.indexOf(toItem[key]);
|
|
13
16
|
var item = items.splice(idxFrom, 1)[0];
|
|
14
17
|
items.splice(idxTo, 0, item);
|
|
15
|
-
return __spreadArray([], items, true);
|
|
18
|
+
return tslib_1.__spreadArray([], items, true);
|
|
16
19
|
}
|
|
17
|
-
|
|
20
|
+
exports.moveSortableArrayItemByKey = moveSortableArrayItemByKey;
|
|
21
|
+
exports.default = moveSortableArrayItemByKey;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.moveSortableArrayItemByKey = void 0;
|
|
4
|
-
var tslib_1 = require("tslib");
|
|
1
|
+
import { __spreadArray } from "tslib";
|
|
5
2
|
/**
|
|
6
3
|
* Move item from one place to another in a sortable array of objects, re-ordering
|
|
7
4
|
* the array accrodingly (no swapping of position).
|
|
@@ -9,13 +6,12 @@ var tslib_1 = require("tslib");
|
|
|
9
6
|
*
|
|
10
7
|
* @category arrays, dnd
|
|
11
8
|
*/
|
|
12
|
-
function moveSortableArrayItemByKey(items, key, fromItem, toItem) {
|
|
9
|
+
export function moveSortableArrayItemByKey(items, key, fromItem, toItem) {
|
|
13
10
|
var itemsKeys = items.map(function (item) { return item[key]; });
|
|
14
11
|
var idxFrom = itemsKeys.indexOf(fromItem[key]);
|
|
15
12
|
var idxTo = itemsKeys.indexOf(toItem[key]);
|
|
16
13
|
var item = items.splice(idxFrom, 1)[0];
|
|
17
14
|
items.splice(idxTo, 0, item);
|
|
18
|
-
return
|
|
15
|
+
return __spreadArray([], items, true);
|
|
19
16
|
}
|
|
20
|
-
|
|
21
|
-
exports.default = moveSortableArrayItemByKey;
|
|
17
|
+
export default moveSortableArrayItemByKey;
|
package/noop.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.noop = void 0;
|
|
1
4
|
/**
|
|
2
5
|
* No operation function
|
|
3
6
|
*
|
|
4
7
|
* @category native
|
|
5
8
|
*/
|
|
6
|
-
|
|
7
|
-
|
|
9
|
+
var noop = function () { return void 0; };
|
|
10
|
+
exports.noop = noop;
|
|
11
|
+
exports.default = exports.noop;
|
package/noop.mjs
ADDED
package/normaliseUrl.js
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.normaliseUrl = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var removeTrailingSlash_1 = tslib_1.__importDefault(require("./removeTrailingSlash"));
|
|
2
6
|
/**
|
|
3
7
|
* Normalise URL, it works both for absolute and relative URLs
|
|
4
8
|
*
|
|
@@ -8,8 +12,9 @@ import removeTralingSlash from "./removeTrailingSlash";
|
|
|
8
12
|
* @category location
|
|
9
13
|
* @see https://stackoverflow.com/a/40649435/1938970
|
|
10
14
|
*/
|
|
11
|
-
|
|
15
|
+
function normaliseUrl(absoluteUrl) {
|
|
12
16
|
if (absoluteUrl === void 0) { absoluteUrl = ""; }
|
|
13
|
-
return
|
|
17
|
+
return (0, removeTrailingSlash_1.default)(absoluteUrl.replace(/(:\/\/)|(\/)+/g, "$1$2"));
|
|
14
18
|
}
|
|
15
|
-
|
|
19
|
+
exports.normaliseUrl = normaliseUrl;
|
|
20
|
+
exports.default = normaliseUrl;
|
package/normaliseUrl.mjs
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import removeTralingSlash from "./removeTrailingSlash";
|
|
2
|
+
/**
|
|
3
|
+
* Normalise URL, it works both for absolute and relative URLs
|
|
4
|
+
*
|
|
5
|
+
* - replaces too many consecutive slashes (except `http{s}://`)
|
|
6
|
+
* - removes the trailing slash
|
|
7
|
+
*
|
|
8
|
+
* @category location
|
|
9
|
+
* @see https://stackoverflow.com/a/40649435/1938970
|
|
10
|
+
*/
|
|
11
|
+
export function normaliseUrl(absoluteUrl) {
|
|
12
|
+
if (absoluteUrl === void 0) { absoluteUrl = ""; }
|
|
13
|
+
return removeTralingSlash(absoluteUrl.replace(/(:\/\/)|(\/)+/g, "$1$2"));
|
|
14
|
+
}
|
|
15
|
+
export default normaliseUrl;
|
package/normaliseUrlPathname.js
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.normaliseUrlPathname = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var removeTrailingSlash_1 = tslib_1.__importDefault(require("./removeTrailingSlash"));
|
|
2
6
|
/**
|
|
3
7
|
* Normalise URL pathname (relative URL)
|
|
4
8
|
*
|
|
@@ -7,8 +11,9 @@ import removeTralingSlash from "./removeTrailingSlash";
|
|
|
7
11
|
*
|
|
8
12
|
* @category location
|
|
9
13
|
*/
|
|
10
|
-
|
|
14
|
+
function normaliseUrlPathname(pathname) {
|
|
11
15
|
if (pathname === void 0) { pathname = ""; }
|
|
12
|
-
return
|
|
16
|
+
return (0, removeTrailingSlash_1.default)(pathname.replace(/\/+/g, "/"));
|
|
13
17
|
}
|
|
14
|
-
|
|
18
|
+
exports.normaliseUrlPathname = normaliseUrlPathname;
|
|
19
|
+
exports.default = normaliseUrlPathname;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import removeTralingSlash from "./removeTrailingSlash";
|
|
2
|
+
/**
|
|
3
|
+
* Normalise URL pathname (relative URL)
|
|
4
|
+
*
|
|
5
|
+
* - replaces too many consecutive slashes
|
|
6
|
+
* - removes the trailing slash
|
|
7
|
+
*
|
|
8
|
+
* @category location
|
|
9
|
+
*/
|
|
10
|
+
export function normaliseUrlPathname(pathname) {
|
|
11
|
+
if (pathname === void 0) { pathname = ""; }
|
|
12
|
+
return removeTralingSlash(pathname.replace(/\/+/g, "/"));
|
|
13
|
+
}
|
|
14
|
+
export default normaliseUrlPathname;
|
package/objectOmit.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.objectOmit = void 0;
|
|
1
4
|
/**
|
|
2
5
|
* Omit object properties by removing the given keys, it returns a
|
|
3
6
|
* new object.
|
|
@@ -7,7 +10,7 @@
|
|
|
7
10
|
*
|
|
8
11
|
* @category objects
|
|
9
12
|
*/
|
|
10
|
-
|
|
13
|
+
function objectOmit(object, keys) {
|
|
11
14
|
return Object.keys(object).reduce(function (output, key) {
|
|
12
15
|
if (!keys.includes(key)) {
|
|
13
16
|
output[key] =
|
|
@@ -16,4 +19,5 @@ export function objectOmit(object, keys) {
|
|
|
16
19
|
return output;
|
|
17
20
|
}, {});
|
|
18
21
|
}
|
|
19
|
-
|
|
22
|
+
exports.objectOmit = objectOmit;
|
|
23
|
+
exports.default = objectOmit;
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.objectOmit = void 0;
|
|
4
1
|
/**
|
|
5
2
|
* Omit object properties by removing the given keys, it returns a
|
|
6
3
|
* new object.
|
|
@@ -10,7 +7,7 @@ exports.objectOmit = void 0;
|
|
|
10
7
|
*
|
|
11
8
|
* @category objects
|
|
12
9
|
*/
|
|
13
|
-
function objectOmit(object, keys) {
|
|
10
|
+
export function objectOmit(object, keys) {
|
|
14
11
|
return Object.keys(object).reduce(function (output, key) {
|
|
15
12
|
if (!keys.includes(key)) {
|
|
16
13
|
output[key] =
|
|
@@ -19,5 +16,4 @@ function objectOmit(object, keys) {
|
|
|
19
16
|
return output;
|
|
20
17
|
}, {});
|
|
21
18
|
}
|
|
22
|
-
|
|
23
|
-
exports.default = objectOmit;
|
|
19
|
+
export default objectOmit;
|
package/objectPick.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.objectPick = void 0;
|
|
1
4
|
/**
|
|
2
5
|
* Pick object properties by selecting only the given keys, it returns a
|
|
3
6
|
* new object.
|
|
4
7
|
*
|
|
5
8
|
* @category objects
|
|
6
9
|
*/
|
|
7
|
-
|
|
10
|
+
function objectPick(object, keys) {
|
|
8
11
|
var output = {};
|
|
9
12
|
var len = keys.length;
|
|
10
13
|
while (len--) {
|
|
@@ -12,4 +15,5 @@ export function objectPick(object, keys) {
|
|
|
12
15
|
}
|
|
13
16
|
return output;
|
|
14
17
|
}
|
|
15
|
-
|
|
18
|
+
exports.objectPick = objectPick;
|
|
19
|
+
exports.default = objectPick;
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.objectPick = void 0;
|
|
4
1
|
/**
|
|
5
2
|
* Pick object properties by selecting only the given keys, it returns a
|
|
6
3
|
* new object.
|
|
7
4
|
*
|
|
8
5
|
* @category objects
|
|
9
6
|
*/
|
|
10
|
-
function objectPick(object, keys) {
|
|
7
|
+
export function objectPick(object, keys) {
|
|
11
8
|
var output = {};
|
|
12
9
|
var len = keys.length;
|
|
13
10
|
while (len--) {
|
|
@@ -15,5 +12,4 @@ function objectPick(object, keys) {
|
|
|
15
12
|
}
|
|
16
13
|
return output;
|
|
17
14
|
}
|
|
18
|
-
|
|
19
|
-
exports.default = objectPick;
|
|
15
|
+
export default objectPick;
|
package/package.json
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@koine/utils",
|
|
3
3
|
"sideEffects": false,
|
|
4
|
-
"
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
"dependencies": {
|
|
5
|
+
"clsx": "1.2.1",
|
|
6
|
+
"ts-debounce": "^4.0.0",
|
|
7
|
+
"type-fest": "^3.5.7"
|
|
8
|
+
},
|
|
7
9
|
"peerDependencies": {
|
|
8
|
-
"
|
|
9
|
-
"type-fest": "3.5.3",
|
|
10
|
-
"tslib": "2.5.0"
|
|
10
|
+
"tslib": "^2.5.0"
|
|
11
11
|
},
|
|
12
|
-
"
|
|
13
|
-
"
|
|
12
|
+
"main": "./index.js",
|
|
13
|
+
"types": "./index.d.ts",
|
|
14
|
+
"version": "1.1.12",
|
|
15
|
+
"module": "./index.mjs"
|
|
14
16
|
}
|
package/parseCookie.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseCookie = void 0;
|
|
1
4
|
/**
|
|
2
5
|
* Try decoding a string using a decoding function.
|
|
3
6
|
*/
|
|
@@ -17,7 +20,7 @@ function tryDecode(str, decode) {
|
|
|
17
20
|
*
|
|
18
21
|
* @category cookie
|
|
19
22
|
*/
|
|
20
|
-
|
|
23
|
+
function parseCookie(str, attributes) {
|
|
21
24
|
if (attributes === void 0) { attributes = {}; }
|
|
22
25
|
if (typeof str !== "string") {
|
|
23
26
|
throw new TypeError("argument str must be a string");
|
|
@@ -45,4 +48,5 @@ export function parseCookie(str, attributes) {
|
|
|
45
48
|
}
|
|
46
49
|
return obj;
|
|
47
50
|
}
|
|
48
|
-
|
|
51
|
+
exports.parseCookie = parseCookie;
|
|
52
|
+
exports.default = parseCookie;
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseCookie = void 0;
|
|
4
1
|
/**
|
|
5
2
|
* Try decoding a string using a decoding function.
|
|
6
3
|
*/
|
|
@@ -20,7 +17,7 @@ function tryDecode(str, decode) {
|
|
|
20
17
|
*
|
|
21
18
|
* @category cookie
|
|
22
19
|
*/
|
|
23
|
-
function parseCookie(str, attributes) {
|
|
20
|
+
export function parseCookie(str, attributes) {
|
|
24
21
|
if (attributes === void 0) { attributes = {}; }
|
|
25
22
|
if (typeof str !== "string") {
|
|
26
23
|
throw new TypeError("argument str must be a string");
|
|
@@ -48,5 +45,4 @@ function parseCookie(str, attributes) {
|
|
|
48
45
|
}
|
|
49
46
|
return obj;
|
|
50
47
|
}
|
|
51
|
-
|
|
52
|
-
exports.default = parseCookie;
|
|
48
|
+
export default parseCookie;
|