@koine/utils 2.0.0-beta.71 → 2.0.0-beta.73
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 +10 -0
- package/Emitter.js +19 -0
- package/accentSets.js +29 -0
- package/addOrReplaceAtIdx.js +14 -0
- package/areEqual.js +45 -0
- package/arrayFilterFalsy.js +1 -0
- package/arrayFindLastIndex.js +8 -0
- package/arrayOfAll.js +1 -0
- package/arraySum.js +1 -0
- package/arrayToLookup.js +4 -0
- package/arrayUniqueByProperties.js +1 -0
- package/buildUrlQueryString.js +20 -0
- package/capitalize.js +2 -0
- package/changeCaseCamel.js +18 -0
- package/changeCaseCapital.js +11 -0
- package/changeCaseConstant.js +7 -0
- package/changeCaseDot.js +2 -0
- package/changeCaseHelpers.d.ts +0 -5
- package/changeCaseHelpers.js +71 -0
- package/changeCaseKebab.js +2 -0
- package/changeCaseNone.js +7 -0
- package/changeCasePascal.js +10 -0
- package/changeCasePascalSnake.js +2 -0
- package/changeCasePath.js +2 -0
- package/changeCaseSentence.js +16 -0
- package/changeCaseSnake.js +2 -0
- package/changeCaseTrain.js +2 -0
- package/chunkByChunks.js +31 -0
- package/chunkBySize.js +7 -0
- package/clamp.js +1 -0
- package/clsx.js +39 -0
- package/convertRange.js +1 -0
- package/cookie.js +1 -0
- package/createPalette.js +11 -0
- package/debounce.js +17 -0
- package/debouncePromise.js +51 -0
- package/debounceRaf.js +12 -0
- package/decode.js +1 -0
- package/encode.js +1 -0
- package/ensureInt.js +1 -0
- package/env.js +1 -0
- package/errorToString.js +2 -0
- package/escapeRegExp.js +1 -0
- package/findDuplicatedIndexes.js +10 -0
- package/forin.js +5 -0
- package/gbToBytes.js +1 -0
- package/getEmptyArray.js +4 -0
- package/getKeys.js +1 -0
- package/getMediaQueryWidthResolvers.js +41 -0
- package/getMediaQueryWidthTailwindScreens.js +26 -0
- package/getNonce.js +2 -0
- package/getParamAmong.js +5 -0
- package/getParamAsInt.js +8 -0
- package/getParamAsString.js +2 -0
- package/getType.js +1 -0
- package/getUrlHashParams.js +8 -0
- package/getUrlHashPathname.js +1 -0
- package/getUrlPathnameParts.js +5 -0
- package/getUrlQueryParams.js +21 -0
- package/imgEmptyPixel.js +1 -0
- package/index.js +156 -0
- package/invariant.js +16 -0
- package/isAbsoluteUrl.js +2 -0
- package/isAnyObject.js +2 -0
- package/isArray.js +2 -0
- package/isBlob.js +2 -0
- package/isBoolean.js +2 -0
- package/isBrowser.js +1 -0
- package/isBrowserNow.js +2 -0
- package/isDate.js +2 -0
- package/isEmptyArray.js +2 -0
- package/isEmptyObject.js +2 -0
- package/isEmptyString.js +1 -0
- package/isError.js +2 -0
- package/isExternalUrl.js +10 -0
- package/isFile.js +2 -0
- package/isFloat.js +2 -0
- package/isFormData.js +2 -0
- package/isFullArray.js +2 -0
- package/isFullObject.js +2 -0
- package/isFullString.js +2 -0
- package/isFunction.js +1 -0
- package/isInt.js +2 -0
- package/isMap.js +2 -0
- package/isNaNValue.js +2 -0
- package/isNegativeNumber.js +2 -0
- package/isNull.js +2 -0
- package/isNullOrUndefined.js +4 -0
- package/isNumber.js +2 -0
- package/isNumericLiteral.js +1 -0
- package/isObject.js +2 -0
- package/isObjectLike.js +2 -0
- package/isObjectStringKeyed.js +2 -0
- package/isOneOf.js +7 -0
- package/isPlainObject.js +5 -0
- package/isPositiveNumber.js +2 -0
- package/isPrimitive.js +12 -0
- package/isPromise.js +2 -0
- package/isRegExp.js +2 -0
- package/isServer.js +2 -0
- package/isServerNow.js +2 -0
- package/isSet.js +2 -0
- package/isString.js +2 -0
- package/isSymbol.js +2 -0
- package/isType.js +12 -0
- package/isUndefined.js +2 -0
- package/isWeakMap.js +2 -0
- package/isWeakSet.js +2 -0
- package/kbToBytes.js +1 -0
- package/location.js +1 -0
- package/lowercase.js +1 -0
- package/mapListBy.js +4 -0
- package/matchSorter.js +238 -0
- package/mbToBytes.js +1 -0
- package/mergeObjects.js +28 -0
- package/mergeUrlQueryParams.js +13 -0
- package/moveSortableArrayItemByKey.js +8 -0
- package/noop.js +1 -0
- package/normaliseUrl.js +2 -0
- package/normaliseUrlPathname.js +2 -0
- package/objectFlat.js +16 -0
- package/objectFlip.js +4 -0
- package/objectMergeWithDefaults.js +20 -0
- package/objectOmit.js +7 -0
- package/objectPick.js +8 -0
- package/objectSort.js +1 -0
- package/objectSortByKeysMatching.js +2 -0
- package/objectToArray.js +1 -0
- package/package.json +1 -1
- package/parseCookie.js +32 -0
- package/parseURL.js +13 -0
- package/quaranteneProps.js +15 -0
- package/randomInt.js +1 -0
- package/randomKey.js +4 -0
- package/readCookie.js +33 -0
- package/removeAccents.js +9 -0
- package/removeCookie.js +9 -0
- package/removeDuplicates.js +1 -0
- package/removeDuplicatesByKey.js +12 -0
- package/removeDuplicatesComparing.js +6 -0
- package/removeIndexesFromArray.js +9 -0
- package/removeTrailingSlash.js +1 -0
- package/removeUrlQueryParams.js +13 -0
- package/render.js +112 -0
- package/round.js +3 -0
- package/roundTo.js +10 -0
- package/serializeCookie.js +68 -0
- package/setCookie.js +44 -0
- package/shuffle.js +16 -0
- package/slugify.js +10 -0
- package/split.js +1 -0
- package/splitReverse.js +1 -0
- package/swapMap.js +7 -0
- package/throttle.js +14 -0
- package/titleCase.js +3 -0
- package/toNumber.js +2 -0
- package/toRgba.js +7 -0
- package/transformToUrlPathname.js +4 -0
- package/truncate.js +5 -0
- package/tryUntil.js +14 -0
- package/types.js +1 -0
- package/uid.js +5 -0
- package/updateLinkParams.js +6 -0
- package/updateUrlQueryParams.js +10 -0
- package/uppercase.js +1 -0
- package/uuid.js +4 -0
- package/uuidNumeric.js +1 -0
- package/wait.js +1 -0
- package/without.js +1 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { getMediaQueryWidthResolvers, } from "./getMediaQueryWidthResolvers";
|
|
2
|
+
export let getMediaQueryWidthTailwindScreens = (breakpoints) => {
|
|
3
|
+
const mqWidthResolvers = getMediaQueryWidthResolvers(breakpoints);
|
|
4
|
+
const screens = Object.keys(breakpoints).reduce((output, br, idx) => {
|
|
5
|
+
const brNext = Object.keys(breakpoints)[idx + 1];
|
|
6
|
+
for (const resolverName in mqWidthResolvers) {
|
|
7
|
+
const resolver = resolverName;
|
|
8
|
+
const resolverFn = mqWidthResolvers[resolver];
|
|
9
|
+
const raw = resolverFn(br);
|
|
10
|
+
if (raw) {
|
|
11
|
+
if (resolverName === "min") {
|
|
12
|
+
output[`@${br}`] = { raw };
|
|
13
|
+
}
|
|
14
|
+
if (resolverName === "between") {
|
|
15
|
+
if (brNext)
|
|
16
|
+
output[`@${resolverName}-${br}_${brNext}`] = { raw };
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
output[`@${resolverName}-${br}`] = { raw };
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return output;
|
|
24
|
+
}, {});
|
|
25
|
+
return screens;
|
|
26
|
+
};
|
package/getNonce.js
ADDED
package/getParamAmong.js
ADDED
package/getParamAsInt.js
ADDED
package/getType.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export let getType = (payload) => Object.prototype.toString.call(payload).slice(8, -1);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export let getUrlHashPathname = (hash = "") => (hash || location.hash).split("?")[0].replace(/^#\//, "");
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { isBrowser } from "./isBrowser";
|
|
2
|
+
export let getUrlQueryParams = (url) => {
|
|
3
|
+
let params = {};
|
|
4
|
+
const search = url
|
|
5
|
+
? url.split("?")?.[1]
|
|
6
|
+
: isBrowser
|
|
7
|
+
? location.search.substring(1)
|
|
8
|
+
: "";
|
|
9
|
+
if (!search) {
|
|
10
|
+
return {};
|
|
11
|
+
}
|
|
12
|
+
try {
|
|
13
|
+
const paramsAsObj = `{"${search
|
|
14
|
+
.replace(/&/g, '","')
|
|
15
|
+
.replace(/=/g, '":"')}"}`;
|
|
16
|
+
params = JSON.parse(paramsAsObj, (key, value) => key === "" ? value : decodeURIComponent(value));
|
|
17
|
+
}
|
|
18
|
+
catch (e) {
|
|
19
|
+
}
|
|
20
|
+
return params;
|
|
21
|
+
};
|
package/imgEmptyPixel.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export let imgEmptyPixel = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=";
|
package/index.js
ADDED
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
export { accentsSets } from "./accentSets";
|
|
2
|
+
export { addOrReplaceAtIdx } from "./addOrReplaceAtIdx";
|
|
3
|
+
export { areEqual } from "./areEqual";
|
|
4
|
+
export { arrayFilterFalsy } from "./arrayFilterFalsy";
|
|
5
|
+
export { arrayFindLastIndex } from "./arrayFindLastIndex";
|
|
6
|
+
export { arrayOfAll } from "./arrayOfAll";
|
|
7
|
+
export { arraySum } from "./arraySum";
|
|
8
|
+
export { arrayToLookup } from "./arrayToLookup";
|
|
9
|
+
export { arrayUniqueByProperties } from "./arrayUniqueByProperties";
|
|
10
|
+
export { buildUrlQueryString } from "./buildUrlQueryString";
|
|
11
|
+
export { capitalize } from "./capitalize";
|
|
12
|
+
export { changeCaseCamel } from "./changeCaseCamel";
|
|
13
|
+
export { changeCaseConstant } from "./changeCaseConstant";
|
|
14
|
+
export { changeCaseDot } from "./changeCaseDot";
|
|
15
|
+
export { changeCaseKebab } from "./changeCaseKebab";
|
|
16
|
+
export { changeCasePascal } from "./changeCasePascal";
|
|
17
|
+
export { changeCasePath } from "./changeCasePath";
|
|
18
|
+
export { changeCaseSentence } from "./changeCaseSentence";
|
|
19
|
+
export { changeCaseSnake } from "./changeCaseSnake";
|
|
20
|
+
export { changeCaseTrain } from "./changeCaseTrain";
|
|
21
|
+
export { chunkByChunks } from "./chunkByChunks";
|
|
22
|
+
export { chunkBySize } from "./chunkBySize";
|
|
23
|
+
export { clamp } from "./clamp";
|
|
24
|
+
export { clsx } from "./clsx";
|
|
25
|
+
export { convertRange } from "./convertRange";
|
|
26
|
+
export {} from "./cookie";
|
|
27
|
+
export { createPalette } from "./createPalette";
|
|
28
|
+
export { debounce } from "./debounce";
|
|
29
|
+
export { debounceRaf } from "./debounceRaf";
|
|
30
|
+
export { debouncePromise, } from "./debouncePromise";
|
|
31
|
+
export { decode } from "./decode";
|
|
32
|
+
export { Defer } from "./Defer";
|
|
33
|
+
export { Emitter } from "./Emitter";
|
|
34
|
+
export { encode } from "./encode";
|
|
35
|
+
export { ensureInt } from "./ensureInt";
|
|
36
|
+
export { errorToString } from "./errorToString";
|
|
37
|
+
export { escapeRegExp } from "./escapeRegExp";
|
|
38
|
+
export { findDuplicatedIndexes } from "./findDuplicatedIndexes";
|
|
39
|
+
export { forin } from "./forin";
|
|
40
|
+
export { gbToBytes } from "./gbToBytes";
|
|
41
|
+
export { getEmptyArray } from "./getEmptyArray";
|
|
42
|
+
export { getKeys } from "./getKeys";
|
|
43
|
+
export { getMediaQueryWidthResolvers, } from "./getMediaQueryWidthResolvers";
|
|
44
|
+
export { getMediaQueryWidthTailwindScreens } from "./getMediaQueryWidthTailwindScreens";
|
|
45
|
+
export { getNonce } from "./getNonce";
|
|
46
|
+
export { getParamAmong } from "./getParamAmong";
|
|
47
|
+
export { getParamAsInt } from "./getParamAsInt";
|
|
48
|
+
export { getParamAsString } from "./getParamAsString";
|
|
49
|
+
export { getType, } from "./getType";
|
|
50
|
+
export { getUrlHashParams } from "./getUrlHashParams";
|
|
51
|
+
export { getUrlHashPathname } from "./getUrlHashPathname";
|
|
52
|
+
export { getUrlPathnameParts } from "./getUrlPathnameParts";
|
|
53
|
+
export { getUrlQueryParams } from "./getUrlQueryParams";
|
|
54
|
+
export { imgEmptyPixel } from "./imgEmptyPixel";
|
|
55
|
+
export { isAbsoluteUrl } from "./isAbsoluteUrl";
|
|
56
|
+
export { isAnyObject } from "./isAnyObject";
|
|
57
|
+
export { isArray } from "./isArray";
|
|
58
|
+
export { isBlob } from "./isBlob";
|
|
59
|
+
export { isBoolean } from "./isBoolean";
|
|
60
|
+
export { isBrowser } from "./isBrowser";
|
|
61
|
+
export { isBrowserNow } from "./isBrowserNow";
|
|
62
|
+
export { isDate } from "./isDate";
|
|
63
|
+
export { isEmptyArray } from "./isEmptyArray";
|
|
64
|
+
export { isEmptyObject } from "./isEmptyObject";
|
|
65
|
+
export { isEmptyString } from "./isEmptyString";
|
|
66
|
+
export { isError } from "./isError";
|
|
67
|
+
export { isExternalUrl } from "./isExternalUrl";
|
|
68
|
+
export { isFile } from "./isFile";
|
|
69
|
+
export { isFloat } from "./isFloat";
|
|
70
|
+
export { isFormData } from "./isFormData";
|
|
71
|
+
export { isFullArray } from "./isFullArray";
|
|
72
|
+
export { isFullObject } from "./isFullObject";
|
|
73
|
+
export { isFullString } from "./isFullString";
|
|
74
|
+
export { isFunction } from "./isFunction";
|
|
75
|
+
export { isInt } from "./isInt";
|
|
76
|
+
export { isMap } from "./isMap";
|
|
77
|
+
export { isNaNValue } from "./isNaNValue";
|
|
78
|
+
export { isNegativeNumber } from "./isNegativeNumber";
|
|
79
|
+
export { isNullOrUndefined } from "./isNullOrUndefined";
|
|
80
|
+
export { isNull } from "./isNull";
|
|
81
|
+
export { isNumber } from "./isNumber";
|
|
82
|
+
export { isNumericLiteral } from "./isNumericLiteral";
|
|
83
|
+
export { isObject } from "./isObject";
|
|
84
|
+
export { isObjectLike } from "./isObjectLike";
|
|
85
|
+
export { isObjectStringKeyed } from "./isObjectStringKeyed";
|
|
86
|
+
export { isOneOf } from "./isOneOf";
|
|
87
|
+
export { isPlainObject } from "./isPlainObject";
|
|
88
|
+
export { isPositiveNumber } from "./isPositiveNumber";
|
|
89
|
+
export { isPrimitive } from "./isPrimitive";
|
|
90
|
+
export { isPromise } from "./isPromise";
|
|
91
|
+
export { isRegExp } from "./isRegExp";
|
|
92
|
+
export { isServer } from "./isServer";
|
|
93
|
+
export { isServerNow } from "./isServerNow";
|
|
94
|
+
export { isSet } from "./isSet";
|
|
95
|
+
export { isString } from "./isString";
|
|
96
|
+
export { isSymbol } from "./isSymbol";
|
|
97
|
+
export { isType } from "./isType";
|
|
98
|
+
export { isUndefined } from "./isUndefined";
|
|
99
|
+
export { isWeakMap } from "./isWeakMap";
|
|
100
|
+
export { isWeakSet } from "./isWeakSet";
|
|
101
|
+
export { kbToBytes } from "./kbToBytes";
|
|
102
|
+
export {} from "./location";
|
|
103
|
+
export { lowercase } from "./lowercase";
|
|
104
|
+
export { mapListBy } from "./mapListBy";
|
|
105
|
+
export { matchSorter } from "./matchSorter";
|
|
106
|
+
export { mbToBytes } from "./mbToBytes";
|
|
107
|
+
export { mergeObjects } from "./mergeObjects";
|
|
108
|
+
export { mergeUrlQueryParams } from "./mergeUrlQueryParams";
|
|
109
|
+
export { moveSortableArrayItemByKey } from "./moveSortableArrayItemByKey";
|
|
110
|
+
export { noop } from "./noop";
|
|
111
|
+
export { normaliseUrlPathname } from "./normaliseUrlPathname";
|
|
112
|
+
export { normaliseUrl } from "./normaliseUrl";
|
|
113
|
+
export { objectFlat } from "./objectFlat";
|
|
114
|
+
export { objectFlip } from "./objectFlip";
|
|
115
|
+
export { objectPick } from "./objectPick";
|
|
116
|
+
export { objectMergeWithDefaults, } from "./objectMergeWithDefaults";
|
|
117
|
+
export { objectOmit } from "./objectOmit";
|
|
118
|
+
export { objectSort } from "./objectSort";
|
|
119
|
+
export { objectSortByKeysMatching } from "./objectSortByKeysMatching";
|
|
120
|
+
export { objectToArray } from "./objectToArray";
|
|
121
|
+
export { parseCookie } from "./parseCookie";
|
|
122
|
+
export { parseURL } from "./parseURL";
|
|
123
|
+
export { quaranteneProps } from "./quaranteneProps";
|
|
124
|
+
export { randomInt } from "./randomInt";
|
|
125
|
+
export { randomKey } from "./randomKey";
|
|
126
|
+
export { readCookie } from "./readCookie";
|
|
127
|
+
export { removeAccents } from "./removeAccents";
|
|
128
|
+
export { removeCookie } from "./removeCookie";
|
|
129
|
+
export { removeDuplicatesByKey } from "./removeDuplicatesByKey";
|
|
130
|
+
export { removeDuplicatesComparing } from "./removeDuplicatesComparing";
|
|
131
|
+
export { removeIndexesFromArray } from "./removeIndexesFromArray";
|
|
132
|
+
export { removeTralingSlash } from "./removeTrailingSlash";
|
|
133
|
+
export { removeUrlQueryParams } from "./removeUrlQueryParams";
|
|
134
|
+
export { round } from "./round";
|
|
135
|
+
export { roundTo } from "./roundTo";
|
|
136
|
+
export { serializeCookie } from "./serializeCookie";
|
|
137
|
+
export { setCookie } from "./setCookie";
|
|
138
|
+
export { shuffle } from "./shuffle";
|
|
139
|
+
export { slugify } from "./slugify";
|
|
140
|
+
export { split } from "./split";
|
|
141
|
+
export { splitReverse } from "./splitReverse";
|
|
142
|
+
export { swapMap } from "./swapMap";
|
|
143
|
+
export { throttle } from "./throttle";
|
|
144
|
+
export { titleCase } from "./titleCase";
|
|
145
|
+
export { toNumber } from "./toNumber";
|
|
146
|
+
export { toRgba } from "./toRgba";
|
|
147
|
+
export { transformToUrlPathname } from "./transformToUrlPathname";
|
|
148
|
+
export { truncate } from "./truncate";
|
|
149
|
+
export { tryUntil } from "./tryUntil";
|
|
150
|
+
export { uid } from "./uid";
|
|
151
|
+
export { updateLinkParams } from "./updateLinkParams";
|
|
152
|
+
export { updateUrlQueryParams } from "./updateUrlQueryParams";
|
|
153
|
+
export { uppercase } from "./uppercase";
|
|
154
|
+
export { uuid } from "./uuid";
|
|
155
|
+
export { uuidNumeric } from "./uuidNumeric";
|
|
156
|
+
export { wait } from "./wait";
|
package/invariant.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export let invariant = (condition, message, lib, prefix) => {
|
|
2
|
+
if (process.env["NODE_ENV"] === "development") {
|
|
3
|
+
if (condition) {
|
|
4
|
+
return;
|
|
5
|
+
}
|
|
6
|
+
const msgProvided = typeof message === "function" ? message() : message;
|
|
7
|
+
let msgPrefix = "";
|
|
8
|
+
if (lib && prefix) {
|
|
9
|
+
msgPrefix = `[${lib}:${prefix}] `;
|
|
10
|
+
}
|
|
11
|
+
else if (lib) {
|
|
12
|
+
msgPrefix = `[${lib}] `;
|
|
13
|
+
}
|
|
14
|
+
throw new Error(msgPrefix + msgProvided);
|
|
15
|
+
}
|
|
16
|
+
};
|
package/isAbsoluteUrl.js
ADDED
package/isAnyObject.js
ADDED
package/isArray.js
ADDED
package/isBlob.js
ADDED
package/isBoolean.js
ADDED
package/isBrowser.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export let isBrowser = typeof window !== "undefined";
|
package/isBrowserNow.js
ADDED
package/isDate.js
ADDED
package/isEmptyArray.js
ADDED
package/isEmptyObject.js
ADDED
package/isEmptyString.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export let isEmptyString = (payload) => payload === "";
|
package/isError.js
ADDED
package/isExternalUrl.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { isBrowser } from "./isBrowser";
|
|
2
|
+
export let isExternalUrl = (url, currentUrl) => {
|
|
3
|
+
const reg = /https?:\/\/((?:[\w\d-]+\.)+[\w\d]{2,})/i;
|
|
4
|
+
const urlMatches = reg.exec(url);
|
|
5
|
+
if (!urlMatches) {
|
|
6
|
+
return false;
|
|
7
|
+
}
|
|
8
|
+
currentUrl = currentUrl || isBrowser ? location.href : "";
|
|
9
|
+
return currentUrl ? reg.exec(currentUrl)?.[1] !== urlMatches[1] : true;
|
|
10
|
+
};
|
package/isFile.js
ADDED
package/isFloat.js
ADDED
package/isFormData.js
ADDED
package/isFullArray.js
ADDED
package/isFullObject.js
ADDED
package/isFullString.js
ADDED
package/isFunction.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export let isFunction = (payload) => typeof payload === "function";
|
package/isInt.js
ADDED
package/isMap.js
ADDED
package/isNaNValue.js
ADDED
package/isNull.js
ADDED
package/isNumber.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export let isNumericLiteral = (payload) => /^[+-]?\d+(\.\d+)?$/.test(payload);
|
package/isObject.js
ADDED
package/isObjectLike.js
ADDED
package/isOneOf.js
ADDED
package/isPlainObject.js
ADDED
package/isPrimitive.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { isBoolean } from "./isBoolean";
|
|
2
|
+
import { isNull } from "./isNull";
|
|
3
|
+
import { isNumber } from "./isNumber";
|
|
4
|
+
import { isString } from "./isString";
|
|
5
|
+
import { isSymbol } from "./isSymbol";
|
|
6
|
+
import { isUndefined } from "./isUndefined";
|
|
7
|
+
export let isPrimitive = (payload) => isBoolean(payload) ||
|
|
8
|
+
isNull(payload) ||
|
|
9
|
+
isUndefined(payload) ||
|
|
10
|
+
isNumber(payload) ||
|
|
11
|
+
isString(payload) ||
|
|
12
|
+
isSymbol(payload);
|
package/isPromise.js
ADDED
package/isRegExp.js
ADDED
package/isServer.js
ADDED
package/isServerNow.js
ADDED
package/isSet.js
ADDED
package/isString.js
ADDED
package/isSymbol.js
ADDED
package/isType.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { getType } from "./getType";
|
|
2
|
+
export let isType = (payload, type) => {
|
|
3
|
+
if (!(type instanceof Function)) {
|
|
4
|
+
throw new TypeError("Type must be a function");
|
|
5
|
+
}
|
|
6
|
+
if (!Object.prototype.hasOwnProperty.call(type, "prototype")) {
|
|
7
|
+
throw new TypeError("Type is not a class");
|
|
8
|
+
}
|
|
9
|
+
const name = type.name;
|
|
10
|
+
return (getType(payload) === name ||
|
|
11
|
+
Boolean(payload && payload.constructor === type));
|
|
12
|
+
};
|
package/isUndefined.js
ADDED
package/isWeakMap.js
ADDED
package/isWeakSet.js
ADDED
package/kbToBytes.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export let kbToBytes = (bytes) => bytes * 1000;
|
package/location.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/lowercase.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export let lowercase = (str) => (str || "").toLowerCase();
|
package/mapListBy.js
ADDED