@koine/utils 2.0.0-beta.4 → 2.0.0-beta.42
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.d.ts +0 -15
- package/Emitter.d.ts +2 -21
- package/README.md +4 -2
- package/accentSets.d.ts +1 -15
- package/addOrReplaceAtIdx.d.ts +1 -5
- package/areEqual.d.ts +2 -17
- package/arrayFilterFalsy.d.ts +1 -0
- package/arrayOfAll.d.ts +1 -28
- package/arraySum.d.ts +1 -7
- package/arrayToLookup.d.ts +1 -7
- package/arrayUniqueByProperties.d.ts +1 -0
- package/buildUrlQueryString.d.ts +2 -12
- package/capitalize.d.ts +1 -8
- package/changeCaseCamel.d.ts +2 -0
- package/changeCaseCapital.d.ts +2 -0
- package/changeCaseConstant.d.ts +2 -0
- package/changeCaseDot.d.ts +2 -0
- package/changeCaseHelpers.d.ts +19 -0
- package/changeCaseKebab.d.ts +2 -0
- package/changeCaseNone.d.ts +2 -0
- package/changeCasePascal.d.ts +2 -0
- package/changeCasePascalSnake.d.ts +2 -0
- package/changeCasePath.d.ts +2 -0
- package/changeCaseSentence.d.ts +2 -0
- package/changeCaseSnake.d.ts +2 -0
- package/changeCaseTrain.d.ts +2 -0
- package/chunkByChunks.d.ts +1 -7
- package/chunkBySize.d.ts +1 -6
- package/clamp.d.ts +1 -8
- package/clsx.d.ts +6 -9
- package/convertRange.d.ts +1 -14
- package/cookie.d.ts +1 -37
- package/createPalette.d.ts +2 -12
- package/debounce.d.ts +1 -8
- package/debouncePromise.d.ts +10 -11
- package/debounceRaf.d.ts +0 -8
- package/decode.d.ts +1 -6
- package/encode.d.ts +1 -6
- package/ensureInt.d.ts +1 -7
- package/env.d.ts +0 -0
- package/errorToString.d.ts +1 -7
- package/findDuplicatedIndexes.d.ts +1 -5
- package/forin.d.ts +1 -7
- package/gbToBytes.d.ts +1 -7
- package/getEmptyArray.d.ts +1 -9
- package/getKeys.d.ts +1 -9
- package/getMediaQueryWidthResolvers.d.ts +1 -2
- package/getMediaQueryWidthTailwindScreens.d.ts +1 -2
- package/getNonce.d.ts +1 -6
- package/getParamAmong.d.ts +1 -12
- package/getParamAsInt.d.ts +1 -12
- package/getParamAsString.d.ts +1 -11
- package/getType.d.ts +4 -17
- package/getUrlHashParams.d.ts +1 -9
- package/getUrlHashPathname.d.ts +1 -9
- package/getUrlPathnameParts.d.ts +1 -12
- package/getUrlQueryParams.d.ts +1 -14
- package/imgEmptyPixel.d.ts +1 -7
- package/index.cjs.d.ts +1 -0
- package/index.cjs.default.js +1 -0
- package/index.cjs.js +482 -0
- package/index.cjs.mjs +2 -0
- package/index.d.ts +24 -5
- package/index.esm.js +330 -0
- package/invariant.d.ts +1 -19
- package/isAnyObject.d.ts +2 -8
- package/isArray.d.ts +1 -7
- package/isBlob.d.ts +1 -7
- package/isBoolean.d.ts +1 -7
- package/isBrowser.d.ts +1 -6
- package/isBrowserNow.d.ts +1 -6
- package/isDate.d.ts +1 -7
- package/isEmptyArray.d.ts +1 -7
- package/isEmptyObject.d.ts +4 -8
- package/isEmptyString.d.ts +1 -7
- package/isError.d.ts +1 -7
- package/isExternalUrl.d.ts +1 -9
- package/isFile.d.ts +1 -7
- package/isFloat.d.ts +1 -7
- package/isFormData.d.ts +1 -7
- package/isFullArray.d.ts +1 -7
- package/isFullObject.d.ts +2 -8
- package/isFullString.d.ts +1 -7
- package/isFunction.d.ts +2 -8
- package/isInt.d.ts +1 -7
- package/isMap.d.ts +1 -7
- package/isNaNValue.d.ts +1 -7
- package/isNegativeNumber.d.ts +1 -7
- package/isNull.d.ts +1 -7
- package/isNullOrUndefined.d.ts +1 -7
- package/isNumber.d.ts +1 -9
- package/isNumericLiteral.d.ts +1 -0
- package/isObject.d.ts +2 -8
- package/isObjectLike.d.ts +2 -10
- package/isObjectStringKeyed.d.ts +2 -0
- package/isOneOf.d.ts +1 -5
- package/isPlainObject.d.ts +2 -8
- package/isPositiveNumber.d.ts +1 -7
- package/isPrimitive.d.ts +1 -7
- package/isPromise.d.ts +1 -7
- package/isRegExp.d.ts +1 -7
- package/isServer.d.ts +1 -6
- package/isServerNow.d.ts +1 -6
- package/isSet.d.ts +1 -7
- package/isString.d.ts +1 -7
- package/isSymbol.d.ts +1 -7
- package/isType.d.ts +2 -11
- package/isUndefined.d.ts +1 -7
- package/isWeakMap.d.ts +1 -7
- package/isWeakSet.d.ts +1 -7
- package/kbToBytes.d.ts +1 -7
- package/location.d.ts +0 -3
- package/lowercase.d.ts +1 -7
- package/mapListBy.d.ts +1 -7
- package/matchSorter.d.ts +2 -10
- package/mbToBytes.d.ts +1 -7
- package/mergeObjects.d.ts +1 -7
- package/mergeUrlQueryParams.d.ts +2 -9
- package/moveSortableArrayItemByKey.d.ts +1 -9
- package/noop.d.ts +1 -7
- package/normaliseUrl.d.ts +1 -11
- package/normaliseUrlPathname.d.ts +1 -10
- package/objectFlat.d.ts +3 -0
- package/objectFlip.d.ts +1 -0
- package/objectOmit.d.ts +1 -11
- package/objectPick.d.ts +1 -8
- package/objectSortByKeysMatching.d.ts +3 -0
- package/objectToArray.d.ts +1 -0
- package/package.json +9 -10
- package/parseCookie.d.ts +2 -11
- package/parseURL.d.ts +1 -8
- package/quaranteneProps.d.ts +2 -17
- package/randomInt.d.ts +1 -7
- package/randomKey.d.ts +1 -8
- package/readCookie.d.ts +0 -1
- package/removeAccents.d.ts +2 -6
- package/removeCookie.d.ts +1 -9
- package/removeDuplicates.d.ts +0 -0
- package/removeDuplicatesByKey.d.ts +1 -8
- package/removeDuplicatesComparing.d.ts +1 -5
- package/removeIndexesFromArray.d.ts +1 -5
- package/removeTrailingSlash.d.ts +1 -7
- package/removeUrlQueryParams.d.ts +1 -8
- package/render.d.ts +2 -41
- package/round.d.ts +2 -0
- package/roundTo.d.ts +1 -8
- package/serializeCookie.d.ts +2 -27
- package/setCookie.d.ts +1 -9
- package/shuffle.d.ts +1 -16
- package/slugify.d.ts +1 -11
- package/split.d.ts +1 -2
- package/splitReverse.d.ts +4 -0
- package/swapMap.d.ts +1 -7
- package/throttle.d.ts +1 -8
- package/titleCase.d.ts +1 -7
- package/toNumber.d.ts +1 -5
- package/toRgba.d.ts +1 -5
- package/transformToUrlPathname.d.ts +1 -11
- package/truncate.d.ts +1 -7
- package/tryUntil.d.ts +1 -8
- package/types.d.ts +1 -18
- package/typings.d.ts +31 -5
- package/uid.d.ts +1 -7
- package/updateLinkParams.d.ts +2 -10
- package/updateUrlQueryParams.d.ts +2 -9
- package/uppercase.d.ts +1 -7
- package/uuid.d.ts +1 -8
- package/uuidNumeric.d.ts +1 -6
- package/wait.d.ts +1 -7
- package/without.d.ts +0 -0
- package/Defer.js +0 -35
- package/Defer.mjs +0 -27
- package/Emitter.js +0 -53
- package/Emitter.mjs +0 -35
- package/accentSets.js +0 -133
- package/accentSets.mjs +0 -122
- package/addOrReplaceAtIdx.js +0 -40
- package/addOrReplaceAtIdx.mjs +0 -22
- package/areEqual.js +0 -75
- package/areEqual.mjs +0 -71
- package/arrayOfAll.js +0 -45
- package/arrayOfAll.mjs +0 -27
- package/arraySum.js +0 -24
- package/arraySum.mjs +0 -6
- package/arrayToLookup.js +0 -29
- package/arrayToLookup.mjs +0 -11
- package/buildUrlQueryString.js +0 -39
- package/buildUrlQueryString.mjs +0 -28
- package/capitalize.js +0 -28
- package/capitalize.mjs +0 -10
- package/changeUrlPath.d.ts +0 -10
- package/changeUrlPath.js +0 -29
- package/changeUrlPath.mjs +0 -17
- package/chunkByChunks.js +0 -52
- package/chunkByChunks.mjs +0 -34
- package/chunkBySize.js +0 -29
- package/chunkBySize.mjs +0 -11
- package/clamp.js +0 -27
- package/clamp.mjs +0 -9
- package/clsx.js +0 -59
- package/clsx.mjs +0 -46
- package/convertRange.js +0 -33
- package/convertRange.mjs +0 -15
- package/cookie.js +0 -21
- package/cookie.mjs +0 -11
- package/createPalette.js +0 -34
- package/createPalette.mjs +0 -25
- package/debounce.js +0 -39
- package/debounce.mjs +0 -21
- package/debouncePromise.js +0 -21
- package/debouncePromise.mjs +0 -8
- package/debounceRaf.js +0 -40
- package/debounceRaf.mjs +0 -22
- package/decode.js +0 -27
- package/decode.mjs +0 -9
- package/encode.js +0 -27
- package/encode.mjs +0 -9
- package/ensureInt.js +0 -24
- package/ensureInt.mjs +0 -6
- package/env.js +0 -3
- package/env.mjs +0 -2
- package/errorToString.js +0 -22
- package/errorToString.mjs +0 -7
- package/findDuplicatedIndexes.js +0 -31
- package/findDuplicatedIndexes.mjs +0 -13
- package/forin.js +0 -28
- package/forin.mjs +0 -10
- package/gbToBytes.js +0 -24
- package/gbToBytes.mjs +0 -6
- package/getEmptyArray.js +0 -29
- package/getEmptyArray.mjs +0 -16
- package/getKeys.js +0 -26
- package/getKeys.mjs +0 -8
- package/getMediaQueryWidthResolvers.js +0 -81
- package/getMediaQueryWidthResolvers.mjs +0 -63
- package/getMediaQueryWidthTailwindScreens.js +0 -51
- package/getMediaQueryWidthTailwindScreens.mjs +0 -33
- package/getNonce.js +0 -23
- package/getNonce.mjs +0 -8
- package/getParamAmong.js +0 -25
- package/getParamAmong.mjs +0 -15
- package/getParamAsInt.js +0 -28
- package/getParamAsInt.mjs +0 -18
- package/getParamAsString.js +0 -24
- package/getParamAsString.mjs +0 -13
- package/getType.js +0 -30
- package/getType.mjs +0 -17
- package/getUrlHashParams.js +0 -27
- package/getUrlHashParams.mjs +0 -14
- package/getUrlHashPathname.js +0 -29
- package/getUrlHashPathname.mjs +0 -11
- package/getUrlPathnameParts.js +0 -25
- package/getUrlPathnameParts.mjs +0 -15
- package/getUrlQueryParams.js +0 -36
- package/getUrlQueryParams.mjs +0 -27
- package/imgEmptyPixel.js +0 -24
- package/imgEmptyPixel.mjs +0 -6
- package/index.js +0 -532
- package/index.mjs +0 -132
- package/invariant.js +0 -50
- package/invariant.mjs +0 -32
- package/isAnyObject.js +0 -24
- package/isAnyObject.mjs +0 -9
- package/isArray.js +0 -24
- package/isArray.mjs +0 -9
- package/isBlob.js +0 -24
- package/isBlob.mjs +0 -9
- package/isBoolean.js +0 -24
- package/isBoolean.mjs +0 -9
- package/isBrowser.js +0 -23
- package/isBrowser.mjs +0 -5
- package/isBrowserNow.js +0 -22
- package/isBrowserNow.mjs +0 -6
- package/isDate.js +0 -24
- package/isDate.mjs +0 -9
- package/isEmptyArray.js +0 -24
- package/isEmptyArray.mjs +0 -9
- package/isEmptyObject.js +0 -24
- package/isEmptyObject.mjs +0 -9
- package/isEmptyString.js +0 -26
- package/isEmptyString.mjs +0 -8
- package/isError.js +0 -24
- package/isError.mjs +0 -9
- package/isExternalUrl.js +0 -32
- package/isExternalUrl.mjs +0 -19
- package/isFile.js +0 -24
- package/isFile.mjs +0 -9
- package/isFloat.js +0 -24
- package/isFloat.mjs +0 -9
- package/isFormData.js +0 -24
- package/isFormData.mjs +0 -9
- package/isFullArray.js +0 -24
- package/isFullArray.mjs +0 -9
- package/isFullObject.js +0 -24
- package/isFullObject.mjs +0 -9
- package/isFullString.js +0 -24
- package/isFullString.mjs +0 -9
- package/isFunction.js +0 -22
- package/isFunction.mjs +0 -8
- package/isInt.js +0 -24
- package/isInt.mjs +0 -9
- package/isMap.js +0 -24
- package/isMap.mjs +0 -9
- package/isNaNValue.js +0 -24
- package/isNaNValue.mjs +0 -9
- package/isNegativeNumber.js +0 -24
- package/isNegativeNumber.mjs +0 -9
- package/isNull.js +0 -24
- package/isNull.mjs +0 -9
- package/isNullOrUndefined.js +0 -24
- package/isNullOrUndefined.mjs +0 -9
- package/isNumber.js +0 -24
- package/isNumber.mjs +0 -11
- package/isObject.js +0 -24
- package/isObject.mjs +0 -9
- package/isObjectLike.js +0 -24
- package/isObjectLike.mjs +0 -11
- package/isOneOf.js +0 -22
- package/isOneOf.mjs +0 -4
- package/isPlainObject.js +0 -25
- package/isPlainObject.mjs +0 -10
- package/isPositiveNumber.js +0 -24
- package/isPositiveNumber.mjs +0 -9
- package/isPrimitive.js +0 -29
- package/isPrimitive.mjs +0 -14
- package/isPromise.js +0 -24
- package/isPromise.mjs +0 -9
- package/isRegExp.js +0 -24
- package/isRegExp.mjs +0 -9
- package/isServer.js +0 -23
- package/isServer.mjs +0 -7
- package/isServerNow.js +0 -22
- package/isServerNow.mjs +0 -6
- package/isSet.js +0 -24
- package/isSet.mjs +0 -9
- package/isString.js +0 -24
- package/isString.mjs +0 -9
- package/isSymbol.js +0 -24
- package/isSymbol.mjs +0 -9
- package/isType.js +0 -32
- package/isType.mjs +0 -20
- package/isUndefined.js +0 -24
- package/isUndefined.mjs +0 -9
- package/isWeakMap.js +0 -24
- package/isWeakMap.mjs +0 -9
- package/isWeakSet.js +0 -24
- package/isWeakSet.mjs +0 -9
- package/kbToBytes.js +0 -24
- package/kbToBytes.mjs +0 -6
- package/location.js +0 -6
- package/location.mjs +0 -3
- package/lowercase.js +0 -24
- package/lowercase.mjs +0 -6
- package/mapListBy.js +0 -29
- package/mapListBy.mjs +0 -11
- package/matchSorter.js +0 -373
- package/matchSorter.mjs +0 -352
- package/mbToBytes.js +0 -24
- package/mbToBytes.mjs +0 -6
- package/mergeObjects.js +0 -39
- package/mergeObjects.mjs +0 -34
- package/mergeUrlQueryParams.js +0 -32
- package/mergeUrlQueryParams.mjs +0 -18
- package/moveSortableArrayItemByKey.js +0 -35
- package/moveSortableArrayItemByKey.mjs +0 -17
- package/noop.js +0 -24
- package/noop.mjs +0 -6
- package/normaliseUrl.js +0 -24
- package/normaliseUrl.mjs +0 -13
- package/normaliseUrlPathname.js +0 -24
- package/normaliseUrlPathname.mjs +0 -12
- package/objectOmit.js +0 -35
- package/objectOmit.mjs +0 -17
- package/objectPick.js +0 -32
- package/objectPick.mjs +0 -14
- package/parseCookie.js +0 -55
- package/parseCookie.mjs +0 -44
- package/parseURL.js +0 -37
- package/parseURL.mjs +0 -19
- package/quaranteneProps.js +0 -49
- package/quaranteneProps.mjs +0 -31
- package/randomInt.js +0 -26
- package/randomInt.mjs +0 -8
- package/randomKey.js +0 -28
- package/randomKey.mjs +0 -10
- package/readCookie.js +0 -51
- package/readCookie.mjs +0 -33
- package/removeAccents.js +0 -28
- package/removeAccents.mjs +0 -12
- package/removeCookie.js +0 -28
- package/removeCookie.mjs +0 -16
- package/removeDuplicates.js +0 -13
- package/removeDuplicates.mjs +0 -12
- package/removeDuplicatesByKey.js +0 -36
- package/removeDuplicatesByKey.mjs +0 -18
- package/removeDuplicatesComparing.js +0 -25
- package/removeDuplicatesComparing.mjs +0 -9
- package/removeIndexesFromArray.js +0 -31
- package/removeIndexesFromArray.mjs +0 -13
- package/removeTrailingSlash.js +0 -26
- package/removeTrailingSlash.mjs +0 -8
- package/removeUrlQueryParams.js +0 -33
- package/removeUrlQueryParams.mjs +0 -19
- package/render.js +0 -93
- package/render.mjs +0 -110
- package/roundTo.js +0 -50
- package/roundTo.mjs +0 -32
- package/serializeCookie.js +0 -102
- package/serializeCookie.mjs +0 -98
- package/setCookie.js +0 -68
- package/setCookie.mjs +0 -55
- package/shuffle.js +0 -50
- package/shuffle.mjs +0 -32
- package/slugify.js +0 -35
- package/slugify.mjs +0 -25
- package/split.js +0 -22
- package/split.mjs +0 -4
- package/swapMap.js +0 -30
- package/swapMap.mjs +0 -12
- package/throttle.js +0 -38
- package/throttle.mjs +0 -20
- package/titleCase.js +0 -24
- package/titleCase.mjs +0 -6
- package/toNumber.js +0 -23
- package/toNumber.mjs +0 -7
- package/toRgba.js +0 -32
- package/toRgba.mjs +0 -14
- package/transformToUrlPathname.js +0 -24
- package/transformToUrlPathname.mjs +0 -13
- package/truncate.js +0 -24
- package/truncate.mjs +0 -6
- package/tryUntil.js +0 -42
- package/tryUntil.mjs +0 -24
- package/types.js +0 -5
- package/types.mjs +0 -2
- package/uid.js +0 -24
- package/uid.mjs +0 -10
- package/updateLinkParams.js +0 -26
- package/updateLinkParams.mjs +0 -13
- package/updateUrlQueryParams.js +0 -28
- package/updateUrlQueryParams.mjs +0 -14
- package/uppercase.js +0 -24
- package/uppercase.mjs +0 -6
- package/uuid.js +0 -28
- package/uuid.mjs +0 -10
- package/uuidNumeric.js +0 -23
- package/uuidNumeric.mjs +0 -5
- package/wait.js +0 -24
- package/wait.mjs +0 -6
- package/without.js +0 -55
- package/without.mjs +0 -54
package/accentSets.js
DELETED
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* First value is the `to`, second is `from`, from *which* chars do we translates *to*
|
|
3
|
-
*
|
|
4
|
-
* @category text
|
|
5
|
-
*/ "use strict";
|
|
6
|
-
Object.defineProperty(exports, "__esModule", {
|
|
7
|
-
value: true
|
|
8
|
-
});
|
|
9
|
-
function _export(target, all) {
|
|
10
|
-
for(var name in all)Object.defineProperty(target, name, {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
get: all[name]
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
_export(exports, {
|
|
16
|
-
accentsSets: function() {
|
|
17
|
-
return accentsSets;
|
|
18
|
-
},
|
|
19
|
-
default: function() {
|
|
20
|
-
return _default;
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
const accentsSets = [
|
|
24
|
-
[
|
|
25
|
-
"a",
|
|
26
|
-
"ÀÁÂÃÅÆĀĂĄẠẢẤẦẨẪẬẮẰẲẴẶ"
|
|
27
|
-
],
|
|
28
|
-
[
|
|
29
|
-
"ae",
|
|
30
|
-
"Ä"
|
|
31
|
-
],
|
|
32
|
-
[
|
|
33
|
-
"c",
|
|
34
|
-
"ÇĆĈČ"
|
|
35
|
-
],
|
|
36
|
-
[
|
|
37
|
-
"d",
|
|
38
|
-
"ÐĎĐÞ"
|
|
39
|
-
],
|
|
40
|
-
[
|
|
41
|
-
"e",
|
|
42
|
-
"ÈÉÊËĒĔĖĘĚẸẺẼẾỀỂỄỆ"
|
|
43
|
-
],
|
|
44
|
-
[
|
|
45
|
-
"g",
|
|
46
|
-
"ĜĞĢǴ"
|
|
47
|
-
],
|
|
48
|
-
[
|
|
49
|
-
"h",
|
|
50
|
-
"ĤḦ"
|
|
51
|
-
],
|
|
52
|
-
[
|
|
53
|
-
"i",
|
|
54
|
-
"ÌÍÎÏĨĪĮİỈỊ"
|
|
55
|
-
],
|
|
56
|
-
[
|
|
57
|
-
"j",
|
|
58
|
-
"Ĵ"
|
|
59
|
-
],
|
|
60
|
-
[
|
|
61
|
-
"ij",
|
|
62
|
-
"IJ"
|
|
63
|
-
],
|
|
64
|
-
[
|
|
65
|
-
"k",
|
|
66
|
-
"Ķ"
|
|
67
|
-
],
|
|
68
|
-
[
|
|
69
|
-
"l",
|
|
70
|
-
"ĹĻĽŁ"
|
|
71
|
-
],
|
|
72
|
-
[
|
|
73
|
-
"m",
|
|
74
|
-
"Ḿ"
|
|
75
|
-
],
|
|
76
|
-
[
|
|
77
|
-
"n",
|
|
78
|
-
"ÑŃŅŇ"
|
|
79
|
-
],
|
|
80
|
-
[
|
|
81
|
-
"o",
|
|
82
|
-
"ÒÓÔÕØŌŎŐỌỎỐỒỔỖỘỚỜỞỠỢǪǬƠ"
|
|
83
|
-
],
|
|
84
|
-
[
|
|
85
|
-
"oe",
|
|
86
|
-
"΅"
|
|
87
|
-
],
|
|
88
|
-
[
|
|
89
|
-
"p",
|
|
90
|
-
"ṕ"
|
|
91
|
-
],
|
|
92
|
-
[
|
|
93
|
-
"r",
|
|
94
|
-
"ŔŖŘ"
|
|
95
|
-
],
|
|
96
|
-
[
|
|
97
|
-
"s",
|
|
98
|
-
"ŚŜŞŠ"
|
|
99
|
-
],
|
|
100
|
-
[
|
|
101
|
-
"ss",
|
|
102
|
-
"ß"
|
|
103
|
-
],
|
|
104
|
-
[
|
|
105
|
-
"t",
|
|
106
|
-
"ŢŤ"
|
|
107
|
-
],
|
|
108
|
-
[
|
|
109
|
-
"u",
|
|
110
|
-
"ÙÚÛŨŪŬŮŰŲỤỦỨỪỬỮỰƯ"
|
|
111
|
-
],
|
|
112
|
-
[
|
|
113
|
-
"ue",
|
|
114
|
-
"Ü"
|
|
115
|
-
],
|
|
116
|
-
[
|
|
117
|
-
"w",
|
|
118
|
-
"ẂŴẀẄ"
|
|
119
|
-
],
|
|
120
|
-
[
|
|
121
|
-
"x",
|
|
122
|
-
"ẍ"
|
|
123
|
-
],
|
|
124
|
-
[
|
|
125
|
-
"y",
|
|
126
|
-
"ÝŶŸỲỴỶỸ"
|
|
127
|
-
],
|
|
128
|
-
[
|
|
129
|
-
"z",
|
|
130
|
-
"ŹŻŽ"
|
|
131
|
-
]
|
|
132
|
-
];
|
|
133
|
-
const _default = accentsSets;
|
package/accentSets.mjs
DELETED
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* First value is the `to`, second is `from`, from *which* chars do we translates *to*
|
|
3
|
-
*
|
|
4
|
-
* @category text
|
|
5
|
-
*/ /**
|
|
6
|
-
* Accent sets
|
|
7
|
-
*
|
|
8
|
-
* @category text
|
|
9
|
-
* @see https://gist.github.com/mathewbyrne/1280286#gistcomment-3498021
|
|
10
|
-
* @see https://gist.github.com/eek/9c4887e80b3ede05c0e39fee4dce3747 for usage
|
|
11
|
-
* of [normalize](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize)
|
|
12
|
-
*/ export const accentsSets = [
|
|
13
|
-
[
|
|
14
|
-
"a",
|
|
15
|
-
"ÀÁÂÃÅÆĀĂĄẠẢẤẦẨẪẬẮẰẲẴẶ"
|
|
16
|
-
],
|
|
17
|
-
[
|
|
18
|
-
"ae",
|
|
19
|
-
"Ä"
|
|
20
|
-
],
|
|
21
|
-
[
|
|
22
|
-
"c",
|
|
23
|
-
"ÇĆĈČ"
|
|
24
|
-
],
|
|
25
|
-
[
|
|
26
|
-
"d",
|
|
27
|
-
"ÐĎĐÞ"
|
|
28
|
-
],
|
|
29
|
-
[
|
|
30
|
-
"e",
|
|
31
|
-
"ÈÉÊËĒĔĖĘĚẸẺẼẾỀỂỄỆ"
|
|
32
|
-
],
|
|
33
|
-
[
|
|
34
|
-
"g",
|
|
35
|
-
"ĜĞĢǴ"
|
|
36
|
-
],
|
|
37
|
-
[
|
|
38
|
-
"h",
|
|
39
|
-
"ĤḦ"
|
|
40
|
-
],
|
|
41
|
-
[
|
|
42
|
-
"i",
|
|
43
|
-
"ÌÍÎÏĨĪĮİỈỊ"
|
|
44
|
-
],
|
|
45
|
-
[
|
|
46
|
-
"j",
|
|
47
|
-
"Ĵ"
|
|
48
|
-
],
|
|
49
|
-
[
|
|
50
|
-
"ij",
|
|
51
|
-
"IJ"
|
|
52
|
-
],
|
|
53
|
-
[
|
|
54
|
-
"k",
|
|
55
|
-
"Ķ"
|
|
56
|
-
],
|
|
57
|
-
[
|
|
58
|
-
"l",
|
|
59
|
-
"ĹĻĽŁ"
|
|
60
|
-
],
|
|
61
|
-
[
|
|
62
|
-
"m",
|
|
63
|
-
"Ḿ"
|
|
64
|
-
],
|
|
65
|
-
[
|
|
66
|
-
"n",
|
|
67
|
-
"ÑŃŅŇ"
|
|
68
|
-
],
|
|
69
|
-
[
|
|
70
|
-
"o",
|
|
71
|
-
"ÒÓÔÕØŌŎŐỌỎỐỒỔỖỘỚỜỞỠỢǪǬƠ"
|
|
72
|
-
],
|
|
73
|
-
[
|
|
74
|
-
"oe",
|
|
75
|
-
"΅"
|
|
76
|
-
],
|
|
77
|
-
[
|
|
78
|
-
"p",
|
|
79
|
-
"ṕ"
|
|
80
|
-
],
|
|
81
|
-
[
|
|
82
|
-
"r",
|
|
83
|
-
"ŔŖŘ"
|
|
84
|
-
],
|
|
85
|
-
[
|
|
86
|
-
"s",
|
|
87
|
-
"ŚŜŞŠ"
|
|
88
|
-
],
|
|
89
|
-
[
|
|
90
|
-
"ss",
|
|
91
|
-
"ß"
|
|
92
|
-
],
|
|
93
|
-
[
|
|
94
|
-
"t",
|
|
95
|
-
"ŢŤ"
|
|
96
|
-
],
|
|
97
|
-
[
|
|
98
|
-
"u",
|
|
99
|
-
"ÙÚÛŨŪŬŮŰŲỤỦỨỪỬỮỰƯ"
|
|
100
|
-
],
|
|
101
|
-
[
|
|
102
|
-
"ue",
|
|
103
|
-
"Ü"
|
|
104
|
-
],
|
|
105
|
-
[
|
|
106
|
-
"w",
|
|
107
|
-
"ẂŴẀẄ"
|
|
108
|
-
],
|
|
109
|
-
[
|
|
110
|
-
"x",
|
|
111
|
-
"ẍ"
|
|
112
|
-
],
|
|
113
|
-
[
|
|
114
|
-
"y",
|
|
115
|
-
"ÝŶŸỲỴỶỸ"
|
|
116
|
-
],
|
|
117
|
-
[
|
|
118
|
-
"z",
|
|
119
|
-
"ŹŻŽ"
|
|
120
|
-
]
|
|
121
|
-
];
|
|
122
|
-
export default accentsSets;
|
package/addOrReplaceAtIdx.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @category array
|
|
3
|
-
*/ "use strict";
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
function _export(target, all) {
|
|
8
|
-
for(var name in all)Object.defineProperty(target, name, {
|
|
9
|
-
enumerable: true,
|
|
10
|
-
get: all[name]
|
|
11
|
-
});
|
|
12
|
-
}
|
|
13
|
-
_export(exports, {
|
|
14
|
-
addOrReplaceAtIdx: function() {
|
|
15
|
-
return addOrReplaceAtIdx;
|
|
16
|
-
},
|
|
17
|
-
default: function() {
|
|
18
|
-
return _default;
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
function addOrReplaceAtIdx(list, newItem, newIdx) {
|
|
22
|
-
if (list.length === 0) {
|
|
23
|
-
return [
|
|
24
|
-
newItem
|
|
25
|
-
];
|
|
26
|
-
}
|
|
27
|
-
if (typeof newIdx === "undefined" || list.length - 1 < newIdx) {
|
|
28
|
-
return [
|
|
29
|
-
...list,
|
|
30
|
-
newItem
|
|
31
|
-
];
|
|
32
|
-
}
|
|
33
|
-
return list.map((item, idx)=>{
|
|
34
|
-
if (idx === newIdx) {
|
|
35
|
-
return newItem;
|
|
36
|
-
}
|
|
37
|
-
return item;
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
const _default = addOrReplaceAtIdx;
|
package/addOrReplaceAtIdx.mjs
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @category array
|
|
3
|
-
*/ export function addOrReplaceAtIdx(list, newItem, newIdx) {
|
|
4
|
-
if (list.length === 0) {
|
|
5
|
-
return [
|
|
6
|
-
newItem
|
|
7
|
-
];
|
|
8
|
-
}
|
|
9
|
-
if (typeof newIdx === "undefined" || list.length - 1 < newIdx) {
|
|
10
|
-
return [
|
|
11
|
-
...list,
|
|
12
|
-
newItem
|
|
13
|
-
];
|
|
14
|
-
}
|
|
15
|
-
return list.map((item, idx)=>{
|
|
16
|
-
if (idx === newIdx) {
|
|
17
|
-
return newItem;
|
|
18
|
-
}
|
|
19
|
-
return item;
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
export default addOrReplaceAtIdx;
|
package/areEqual.js
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
function _export(target, all) {
|
|
6
|
-
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: all[name]
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
_export(exports, {
|
|
12
|
-
areEqual: function() {
|
|
13
|
-
return areEqual;
|
|
14
|
-
},
|
|
15
|
-
default: function() {
|
|
16
|
-
return _default;
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
const _isArray = require("./isArray");
|
|
20
|
-
const _isObject = require("./isObject");
|
|
21
|
-
function areEqualArrays(a, b) {
|
|
22
|
-
if (!b) return false;
|
|
23
|
-
if (a.length !== b.length) return false;
|
|
24
|
-
for(let i = 0; i < a.length; i++){
|
|
25
|
-
const aValue = a[i];
|
|
26
|
-
const bValue = b[i];
|
|
27
|
-
if (!areEqual(aValue, bValue)) return false;
|
|
28
|
-
}
|
|
29
|
-
return true;
|
|
30
|
-
}
|
|
31
|
-
function areEqualObjects(a, b) {
|
|
32
|
-
if (!b) return false;
|
|
33
|
-
const aKeys = Object.keys(a);
|
|
34
|
-
const bKeys = Object.keys(b);
|
|
35
|
-
if (aKeys.length !== bKeys.length) {
|
|
36
|
-
return false;
|
|
37
|
-
}
|
|
38
|
-
for (const _key of aKeys){
|
|
39
|
-
const key = _key;
|
|
40
|
-
const aValue = a[key];
|
|
41
|
-
const bValue = b[key];
|
|
42
|
-
if (!areEqual(aValue, bValue)) {
|
|
43
|
-
return false;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
return true;
|
|
47
|
-
}
|
|
48
|
-
function areEqual(a, b) {
|
|
49
|
-
if (!a && !b) {
|
|
50
|
-
// console.log(`areEqual took ${performance.now() - t0} ms`);
|
|
51
|
-
return true;
|
|
52
|
-
}
|
|
53
|
-
// const t0 = performance.now();
|
|
54
|
-
if (!b && a !== b) {
|
|
55
|
-
// console.log(`areEqual took ${performance.now() - t0} ms`);
|
|
56
|
-
return false;
|
|
57
|
-
}
|
|
58
|
-
const areObjects = (0, _isObject.isObject)(a) && (0, _isObject.isObject)(b);
|
|
59
|
-
if (areObjects && !areEqualObjects(a, b)) {
|
|
60
|
-
// console.log(`areEqual took ${performance.now() - t0} ms`);
|
|
61
|
-
return false;
|
|
62
|
-
}
|
|
63
|
-
const areArrays = (0, _isArray.isArray)(a) && (0, _isArray.isArray)(b);
|
|
64
|
-
if (areArrays && !areEqualArrays(a, b)) {
|
|
65
|
-
// console.log(`areEqual took ${performance.now() - t0} ms`);
|
|
66
|
-
return false;
|
|
67
|
-
}
|
|
68
|
-
if (!areObjects && !areArrays && a !== b) {
|
|
69
|
-
// console.log(`areEqual took ${performance.now() - t0} ms`);
|
|
70
|
-
return false;
|
|
71
|
-
}
|
|
72
|
-
// console.log(`areEqual took ${performance.now() - t0} ms`);
|
|
73
|
-
return true;
|
|
74
|
-
}
|
|
75
|
-
const _default = areEqual;
|
package/areEqual.mjs
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { isArray } from "./isArray";
|
|
2
|
-
import { isObject } from "./isObject";
|
|
3
|
-
function areEqualArrays(a, b) {
|
|
4
|
-
if (!b) return false;
|
|
5
|
-
if (a.length !== b.length) return false;
|
|
6
|
-
for(let i = 0; i < a.length; i++){
|
|
7
|
-
const aValue = a[i];
|
|
8
|
-
const bValue = b[i];
|
|
9
|
-
if (!areEqual(aValue, bValue)) return false;
|
|
10
|
-
}
|
|
11
|
-
return true;
|
|
12
|
-
}
|
|
13
|
-
function areEqualObjects(a, b) {
|
|
14
|
-
if (!b) return false;
|
|
15
|
-
const aKeys = Object.keys(a);
|
|
16
|
-
const bKeys = Object.keys(b);
|
|
17
|
-
if (aKeys.length !== bKeys.length) {
|
|
18
|
-
return false;
|
|
19
|
-
}
|
|
20
|
-
for (const _key of aKeys){
|
|
21
|
-
const key = _key;
|
|
22
|
-
const aValue = a[key];
|
|
23
|
-
const bValue = b[key];
|
|
24
|
-
if (!areEqual(aValue, bValue)) {
|
|
25
|
-
return false;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
return true;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* A simple and quick deep equal objects utility. This is meant to be used
|
|
32
|
-
* solely to deduplicate requests payload and perform comparison on JSON ready
|
|
33
|
-
* objects made of primitives `string`, `number` and `boolean`s.
|
|
34
|
-
*
|
|
35
|
-
* It support nested `object`s and `array`s only.
|
|
36
|
-
*
|
|
37
|
-
* NB: `undefined` and `null` values do not count in the comparison as they are
|
|
38
|
-
* usually meant to be ignored in JSON requestBody payloads.
|
|
39
|
-
*
|
|
40
|
-
* According to very rudimentary tests this function takes on average between
|
|
41
|
-
* 0.15 ms and 2ms to compare two averaged sizes requet body payloads.
|
|
42
|
-
*
|
|
43
|
-
* @category objects
|
|
44
|
-
*/ export function areEqual(a, b) {
|
|
45
|
-
if (!a && !b) {
|
|
46
|
-
// console.log(`areEqual took ${performance.now() - t0} ms`);
|
|
47
|
-
return true;
|
|
48
|
-
}
|
|
49
|
-
// const t0 = performance.now();
|
|
50
|
-
if (!b && a !== b) {
|
|
51
|
-
// console.log(`areEqual took ${performance.now() - t0} ms`);
|
|
52
|
-
return false;
|
|
53
|
-
}
|
|
54
|
-
const areObjects = isObject(a) && isObject(b);
|
|
55
|
-
if (areObjects && !areEqualObjects(a, b)) {
|
|
56
|
-
// console.log(`areEqual took ${performance.now() - t0} ms`);
|
|
57
|
-
return false;
|
|
58
|
-
}
|
|
59
|
-
const areArrays = isArray(a) && isArray(b);
|
|
60
|
-
if (areArrays && !areEqualArrays(a, b)) {
|
|
61
|
-
// console.log(`areEqual took ${performance.now() - t0} ms`);
|
|
62
|
-
return false;
|
|
63
|
-
}
|
|
64
|
-
if (!areObjects && !areArrays && a !== b) {
|
|
65
|
-
// console.log(`areEqual took ${performance.now() - t0} ms`);
|
|
66
|
-
return false;
|
|
67
|
-
}
|
|
68
|
-
// console.log(`areEqual took ${performance.now() - t0} ms`);
|
|
69
|
-
return true;
|
|
70
|
-
}
|
|
71
|
-
export default areEqual;
|
package/arrayOfAll.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Ensure an array contains all desired values
|
|
3
|
-
*
|
|
4
|
-
* @category array
|
|
5
|
-
* @borrows [SO comment by `CertainPerformance`](https://stackoverflow.com/a/60132060/1938970)
|
|
6
|
-
*
|
|
7
|
-
* @usage
|
|
8
|
-
*
|
|
9
|
-
* ```
|
|
10
|
-
* type Fruit = "pear" | "apple" | "orange";
|
|
11
|
-
*
|
|
12
|
-
* const arrayOfAllFruits = arrayOfAll<Fruit>();
|
|
13
|
-
*
|
|
14
|
-
* const allFruits = arrayOfAllFruits([
|
|
15
|
-
* "pear",
|
|
16
|
-
* "apple",
|
|
17
|
-
* "orange"
|
|
18
|
-
* ]); // ts compiler ok
|
|
19
|
-
*
|
|
20
|
-
* const allFruits = arrayOfAllFruits([
|
|
21
|
-
* "pear",
|
|
22
|
-
* "apple",
|
|
23
|
-
* ]); // ts compiler fails
|
|
24
|
-
* ```
|
|
25
|
-
*
|
|
26
|
-
*/ "use strict";
|
|
27
|
-
Object.defineProperty(exports, "__esModule", {
|
|
28
|
-
value: true
|
|
29
|
-
});
|
|
30
|
-
function _export(target, all) {
|
|
31
|
-
for(var name in all)Object.defineProperty(target, name, {
|
|
32
|
-
enumerable: true,
|
|
33
|
-
get: all[name]
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
_export(exports, {
|
|
37
|
-
arrayOfAll: function() {
|
|
38
|
-
return arrayOfAll;
|
|
39
|
-
},
|
|
40
|
-
default: function() {
|
|
41
|
-
return _default;
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
const arrayOfAll = ()=>(array)=>array;
|
|
45
|
-
const _default = arrayOfAll;
|
package/arrayOfAll.mjs
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Ensure an array contains all desired values
|
|
3
|
-
*
|
|
4
|
-
* @category array
|
|
5
|
-
* @borrows [SO comment by `CertainPerformance`](https://stackoverflow.com/a/60132060/1938970)
|
|
6
|
-
*
|
|
7
|
-
* @usage
|
|
8
|
-
*
|
|
9
|
-
* ```
|
|
10
|
-
* type Fruit = "pear" | "apple" | "orange";
|
|
11
|
-
*
|
|
12
|
-
* const arrayOfAllFruits = arrayOfAll<Fruit>();
|
|
13
|
-
*
|
|
14
|
-
* const allFruits = arrayOfAllFruits([
|
|
15
|
-
* "pear",
|
|
16
|
-
* "apple",
|
|
17
|
-
* "orange"
|
|
18
|
-
* ]); // ts compiler ok
|
|
19
|
-
*
|
|
20
|
-
* const allFruits = arrayOfAllFruits([
|
|
21
|
-
* "pear",
|
|
22
|
-
* "apple",
|
|
23
|
-
* ]); // ts compiler fails
|
|
24
|
-
* ```
|
|
25
|
-
*
|
|
26
|
-
*/ export const arrayOfAll = ()=>(array)=>array;
|
|
27
|
-
export default arrayOfAll;
|
package/arraySum.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Sum array of numbers
|
|
3
|
-
*
|
|
4
|
-
* @category array | math
|
|
5
|
-
*/ "use strict";
|
|
6
|
-
Object.defineProperty(exports, "__esModule", {
|
|
7
|
-
value: true
|
|
8
|
-
});
|
|
9
|
-
function _export(target, all) {
|
|
10
|
-
for(var name in all)Object.defineProperty(target, name, {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
get: all[name]
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
_export(exports, {
|
|
16
|
-
arraySum: function() {
|
|
17
|
-
return arraySum;
|
|
18
|
-
},
|
|
19
|
-
default: function() {
|
|
20
|
-
return _default;
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
const arraySum = (numbers)=>numbers.reduce((sum, current)=>sum + current, 0);
|
|
24
|
-
const _default = arraySum;
|
package/arraySum.mjs
DELETED
package/arrayToLookup.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Maps a simple flat array to a lookup dictionary object
|
|
3
|
-
*
|
|
4
|
-
* @category array
|
|
5
|
-
*/ "use strict";
|
|
6
|
-
Object.defineProperty(exports, "__esModule", {
|
|
7
|
-
value: true
|
|
8
|
-
});
|
|
9
|
-
function _export(target, all) {
|
|
10
|
-
for(var name in all)Object.defineProperty(target, name, {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
get: all[name]
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
_export(exports, {
|
|
16
|
-
arrayToLookup: function() {
|
|
17
|
-
return arrayToLookup;
|
|
18
|
-
},
|
|
19
|
-
default: function() {
|
|
20
|
-
return _default;
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
function arrayToLookup(array = []) {
|
|
24
|
-
return array.reduce((obj, item)=>{
|
|
25
|
-
obj[item] = 1;
|
|
26
|
-
return obj;
|
|
27
|
-
}, {});
|
|
28
|
-
}
|
|
29
|
-
const _default = arrayToLookup;
|
package/arrayToLookup.mjs
DELETED
package/buildUrlQueryString.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
function _export(target, all) {
|
|
6
|
-
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: all[name]
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
_export(exports, {
|
|
12
|
-
buildUrlQueryString: function() {
|
|
13
|
-
return buildUrlQueryString;
|
|
14
|
-
},
|
|
15
|
-
default: function() {
|
|
16
|
-
return _default;
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
|
|
20
|
-
const _isArray = /*#__PURE__*/ _interop_require_default._(require("./isArray"));
|
|
21
|
-
const _isNull = /*#__PURE__*/ _interop_require_default._(require("./isNull"));
|
|
22
|
-
const _isUndefined = /*#__PURE__*/ _interop_require_default._(require("./isUndefined"));
|
|
23
|
-
function buildUrlQueryString(params) {
|
|
24
|
-
let output = "";
|
|
25
|
-
if (!params) return output;
|
|
26
|
-
for(const key in params){
|
|
27
|
-
const value = params[key];
|
|
28
|
-
if ((0, _isArray.default)(value)) {
|
|
29
|
-
for(let i = 0; i < value.length; i++){
|
|
30
|
-
output += `${key}=${encodeURIComponent(value[i] + "")}&`;
|
|
31
|
-
}
|
|
32
|
-
} else if (!(0, _isNull.default)(value) && !(0, _isUndefined.default)(value)) {
|
|
33
|
-
output += `${key}=${encodeURIComponent(value + "")}&`;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
// removes the last &
|
|
37
|
-
return output ? `?${output.replace(/&+$/, "")}` : "";
|
|
38
|
-
}
|
|
39
|
-
const _default = buildUrlQueryString;
|
package/buildUrlQueryString.mjs
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import isArray from "./isArray";
|
|
2
|
-
import isNull from "./isNull";
|
|
3
|
-
import isUndefined from "./isUndefined";
|
|
4
|
-
/**
|
|
5
|
-
* Get clean query string for URL
|
|
6
|
-
*
|
|
7
|
-
* It returns the query string **with** the initial `?`
|
|
8
|
-
*
|
|
9
|
-
* TODO: at some point replace with `URLSearchParams`, @see [caniuse](https://caniuse.com/?search=URLSearchParams)
|
|
10
|
-
*
|
|
11
|
-
* @category location
|
|
12
|
-
*/ export function buildUrlQueryString(params) {
|
|
13
|
-
let output = "";
|
|
14
|
-
if (!params) return output;
|
|
15
|
-
for(const key in params){
|
|
16
|
-
const value = params[key];
|
|
17
|
-
if (isArray(value)) {
|
|
18
|
-
for(let i = 0; i < value.length; i++){
|
|
19
|
-
output += `${key}=${encodeURIComponent(value[i] + "")}&`;
|
|
20
|
-
}
|
|
21
|
-
} else if (!isNull(value) && !isUndefined(value)) {
|
|
22
|
-
output += `${key}=${encodeURIComponent(value + "")}&`;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
// removes the last &
|
|
26
|
-
return output ? `?${output.replace(/&+$/, "")}` : "";
|
|
27
|
-
}
|
|
28
|
-
export default buildUrlQueryString;
|