@koine/utils 1.1.10 → 1.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Defer.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 +4 -3
- 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/isObject.js
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isObject = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var isPlainObject_1 = tslib_1.__importDefault(require("./isPlainObject"));
|
|
2
6
|
/**
|
|
3
7
|
* Returns whether the payload is a plain JavaScript object (excluding special classes or objects with other prototypes)
|
|
4
8
|
*
|
|
5
9
|
* @category is
|
|
6
10
|
*/
|
|
7
|
-
|
|
8
|
-
return
|
|
11
|
+
function isObject(payload) {
|
|
12
|
+
return (0, isPlainObject_1.default)(payload);
|
|
9
13
|
}
|
|
10
|
-
|
|
14
|
+
exports.isObject = isObject;
|
|
15
|
+
exports.default = isObject;
|
package/isObject.mjs
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import isPlainObject from "./isPlainObject";
|
|
2
|
+
/**
|
|
3
|
+
* Returns whether the payload is a plain JavaScript object (excluding special classes or objects with other prototypes)
|
|
4
|
+
*
|
|
5
|
+
* @category is
|
|
6
|
+
*/
|
|
7
|
+
export function isObject(payload) {
|
|
8
|
+
return isPlainObject(payload);
|
|
9
|
+
}
|
|
10
|
+
export default isObject;
|
package/isObjectLike.js
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isObjectLike = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var isAnyObject_1 = tslib_1.__importDefault(require("./isAnyObject"));
|
|
2
6
|
/**
|
|
3
7
|
* Returns whether the payload is an object like a type passed in < >
|
|
4
8
|
*
|
|
@@ -6,7 +10,8 @@ import isAnyObject from "./isAnyObject";
|
|
|
6
10
|
*
|
|
7
11
|
* @category is
|
|
8
12
|
*/
|
|
9
|
-
|
|
10
|
-
return
|
|
13
|
+
function isObjectLike(payload) {
|
|
14
|
+
return (0, isAnyObject_1.default)(payload);
|
|
11
15
|
}
|
|
12
|
-
|
|
16
|
+
exports.isObjectLike = isObjectLike;
|
|
17
|
+
exports.default = isObjectLike;
|
package/isObjectLike.mjs
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import isAnyObject from "./isAnyObject";
|
|
2
|
+
/**
|
|
3
|
+
* Returns whether the payload is an object like a type passed in < >
|
|
4
|
+
*
|
|
5
|
+
* Usage: isObjectLike<{id: any}>(payload) // will make sure it's an object and has an `id` prop.
|
|
6
|
+
*
|
|
7
|
+
* @category is
|
|
8
|
+
*/
|
|
9
|
+
export function isObjectLike(payload) {
|
|
10
|
+
return isAnyObject(payload);
|
|
11
|
+
}
|
|
12
|
+
export default isObjectLike;
|
package/isOneOf.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isOneOf = void 0;
|
|
4
|
+
function isOneOf(a, b, c, d, e) {
|
|
2
5
|
return function (value) {
|
|
3
6
|
return a(value) ||
|
|
4
7
|
b(value) ||
|
|
@@ -7,4 +10,5 @@ export function isOneOf(a, b, c, d, e) {
|
|
|
7
10
|
(!!e && e(value));
|
|
8
11
|
};
|
|
9
12
|
}
|
|
10
|
-
|
|
13
|
+
exports.isOneOf = isOneOf;
|
|
14
|
+
exports.default = isOneOf;
|
package/isOneOf.mjs
ADDED
package/isPlainObject.js
CHANGED
|
@@ -1,13 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isPlainObject = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var getType_1 = tslib_1.__importDefault(require("./getType"));
|
|
2
6
|
/**
|
|
3
7
|
* Returns whether the payload is a plain JavaScript object (excluding special classes or objects with other prototypes)
|
|
4
8
|
*
|
|
5
9
|
* @category is
|
|
6
10
|
*/
|
|
7
|
-
|
|
8
|
-
if (
|
|
11
|
+
function isPlainObject(payload) {
|
|
12
|
+
if ((0, getType_1.default)(payload) !== "Object")
|
|
9
13
|
return false;
|
|
10
14
|
return (payload.constructor === Object &&
|
|
11
15
|
Object.getPrototypeOf(payload) === Object.prototype);
|
|
12
16
|
}
|
|
13
|
-
|
|
17
|
+
exports.isPlainObject = isPlainObject;
|
|
18
|
+
exports.default = isPlainObject;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import getType from "./getType";
|
|
2
|
+
/**
|
|
3
|
+
* Returns whether the payload is a plain JavaScript object (excluding special classes or objects with other prototypes)
|
|
4
|
+
*
|
|
5
|
+
* @category is
|
|
6
|
+
*/
|
|
7
|
+
export function isPlainObject(payload) {
|
|
8
|
+
if (getType(payload) !== "Object")
|
|
9
|
+
return false;
|
|
10
|
+
return (payload.constructor === Object &&
|
|
11
|
+
Object.getPrototypeOf(payload) === Object.prototype);
|
|
12
|
+
}
|
|
13
|
+
export default isPlainObject;
|
package/isPositiveNumber.js
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isPositiveNumber = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var isNumber_1 = tslib_1.__importDefault(require("./isNumber"));
|
|
2
6
|
/**
|
|
3
7
|
* Returns whether the payload is a positive number (but not 0)
|
|
4
8
|
*
|
|
5
9
|
* @category is
|
|
6
10
|
*/
|
|
7
|
-
|
|
8
|
-
return
|
|
11
|
+
function isPositiveNumber(payload) {
|
|
12
|
+
return (0, isNumber_1.default)(payload) && payload > 0;
|
|
9
13
|
}
|
|
10
|
-
|
|
14
|
+
exports.isPositiveNumber = isPositiveNumber;
|
|
15
|
+
exports.default = isPositiveNumber;
|
package/isPrimitive.js
CHANGED
|
@@ -1,20 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isPrimitive = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var isString_1 = tslib_1.__importDefault(require("./isString"));
|
|
6
|
+
var isNull_1 = tslib_1.__importDefault(require("./isNull"));
|
|
7
|
+
var isNumber_1 = tslib_1.__importDefault(require("./isNumber"));
|
|
8
|
+
var isUndefined_1 = tslib_1.__importDefault(require("./isUndefined"));
|
|
9
|
+
var isBoolean_1 = tslib_1.__importDefault(require("./isBoolean"));
|
|
10
|
+
var isSymbol_1 = tslib_1.__importDefault(require("./isSymbol"));
|
|
7
11
|
/**
|
|
8
12
|
* Returns whether the payload is a primitive type (eg. Boolean | Null | Undefined | Number | String | Symbol)
|
|
9
13
|
*
|
|
10
14
|
* @category is
|
|
11
15
|
*/
|
|
12
|
-
|
|
13
|
-
return (
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
function isPrimitive(payload) {
|
|
17
|
+
return ((0, isBoolean_1.default)(payload) ||
|
|
18
|
+
(0, isNull_1.default)(payload) ||
|
|
19
|
+
(0, isUndefined_1.default)(payload) ||
|
|
20
|
+
(0, isNumber_1.default)(payload) ||
|
|
21
|
+
(0, isString_1.default)(payload) ||
|
|
22
|
+
(0, isSymbol_1.default)(payload));
|
|
19
23
|
}
|
|
20
|
-
|
|
24
|
+
exports.isPrimitive = isPrimitive;
|
|
25
|
+
exports.default = isPrimitive;
|
package/isPrimitive.mjs
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import isString from "./isString";
|
|
2
|
+
import isNull from "./isNull";
|
|
3
|
+
import isNumber from "./isNumber";
|
|
4
|
+
import isUndefined from "./isUndefined";
|
|
5
|
+
import isBoolean from "./isBoolean";
|
|
6
|
+
import isSymbol from "./isSymbol";
|
|
7
|
+
/**
|
|
8
|
+
* Returns whether the payload is a primitive type (eg. Boolean | Null | Undefined | Number | String | Symbol)
|
|
9
|
+
*
|
|
10
|
+
* @category is
|
|
11
|
+
*/
|
|
12
|
+
export function isPrimitive(payload) {
|
|
13
|
+
return (isBoolean(payload) ||
|
|
14
|
+
isNull(payload) ||
|
|
15
|
+
isUndefined(payload) ||
|
|
16
|
+
isNumber(payload) ||
|
|
17
|
+
isString(payload) ||
|
|
18
|
+
isSymbol(payload));
|
|
19
|
+
}
|
|
20
|
+
export default isPrimitive;
|
package/isPromise.js
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isPromise = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var getType_1 = tslib_1.__importDefault(require("./getType"));
|
|
2
6
|
/**
|
|
3
7
|
* Returns whether the payload is a Promise
|
|
4
8
|
*
|
|
5
9
|
* @category is
|
|
6
10
|
*/
|
|
7
|
-
|
|
8
|
-
return
|
|
11
|
+
function isPromise(payload) {
|
|
12
|
+
return (0, getType_1.default)(payload) === "Promise";
|
|
9
13
|
}
|
|
10
|
-
|
|
14
|
+
exports.isPromise = isPromise;
|
|
15
|
+
exports.default = isPromise;
|
package/isPromise.mjs
ADDED
package/isRegExp.js
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isRegExp = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var getType_1 = tslib_1.__importDefault(require("./getType"));
|
|
2
6
|
/**
|
|
3
7
|
* Returns whether the payload is a regular expression (RegExp)
|
|
4
8
|
*
|
|
5
9
|
* @category is
|
|
6
10
|
*/
|
|
7
|
-
|
|
8
|
-
return
|
|
11
|
+
function isRegExp(payload) {
|
|
12
|
+
return (0, getType_1.default)(payload) === "RegExp";
|
|
9
13
|
}
|
|
10
|
-
|
|
14
|
+
exports.isRegExp = isRegExp;
|
|
15
|
+
exports.default = isRegExp;
|
package/isRegExp.mjs
ADDED
package/isServer.js
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isServer = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var isBrowser_1 = tslib_1.__importDefault(require("./isBrowser"));
|
|
2
6
|
/**
|
|
3
7
|
* @category ssr
|
|
4
8
|
* @category is
|
|
5
9
|
*/
|
|
6
|
-
|
|
10
|
+
exports.isServer = !isBrowser_1.default;
|
|
7
11
|
// export const isServer = typeof window === "undefined";
|
|
8
12
|
// export const isServer = () => typeof window === "undefined";
|
|
9
|
-
|
|
13
|
+
exports.default = exports.isServer;
|
package/isServer.mjs
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import isBrowser from "./isBrowser";
|
|
2
|
+
/**
|
|
3
|
+
* @category ssr
|
|
4
|
+
* @category is
|
|
5
|
+
*/
|
|
6
|
+
export var isServer = !isBrowser;
|
|
7
|
+
// export const isServer = typeof window === "undefined";
|
|
8
|
+
// export const isServer = () => typeof window === "undefined";
|
|
9
|
+
export default isServer;
|
package/isSet.js
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isSet = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var getType_1 = tslib_1.__importDefault(require("./getType"));
|
|
2
6
|
/**
|
|
3
7
|
* Returns whether the payload is a Set
|
|
4
8
|
*
|
|
5
9
|
* @category is
|
|
6
10
|
*/
|
|
7
|
-
|
|
8
|
-
return
|
|
11
|
+
function isSet(payload) {
|
|
12
|
+
return (0, getType_1.default)(payload) === "Set";
|
|
9
13
|
}
|
|
10
|
-
|
|
14
|
+
exports.isSet = isSet;
|
|
15
|
+
exports.default = isSet;
|
package/isSet.mjs
ADDED
package/isString.js
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isString = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var getType_1 = tslib_1.__importDefault(require("./getType"));
|
|
2
6
|
/**
|
|
3
7
|
* Returns whether the payload is a string
|
|
4
8
|
*
|
|
5
9
|
* @category is
|
|
6
10
|
*/
|
|
7
|
-
|
|
8
|
-
return
|
|
11
|
+
function isString(payload) {
|
|
12
|
+
return (0, getType_1.default)(payload) === "String";
|
|
9
13
|
}
|
|
10
|
-
|
|
14
|
+
exports.isString = isString;
|
|
15
|
+
exports.default = isString;
|
package/isString.mjs
ADDED
package/isSymbol.js
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isSymbol = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var getType_1 = tslib_1.__importDefault(require("./getType"));
|
|
2
6
|
/**
|
|
3
7
|
* Returns whether the payload is a Symbol
|
|
4
8
|
*
|
|
5
9
|
* @category is
|
|
6
10
|
*/
|
|
7
|
-
|
|
8
|
-
return
|
|
11
|
+
function isSymbol(payload) {
|
|
12
|
+
return (0, getType_1.default)(payload) === "Symbol";
|
|
9
13
|
}
|
|
10
|
-
|
|
14
|
+
exports.isSymbol = isSymbol;
|
|
15
|
+
exports.default = isSymbol;
|
package/isSymbol.mjs
ADDED
package/isType.js
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isType = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var getType_1 = tslib_1.__importDefault(require("./getType"));
|
|
2
6
|
/**
|
|
3
7
|
* Does a generic check to check that the given payload is of a given type.
|
|
4
8
|
* In cases like Number, it will return true for NaN as NaN is a Number (thanks javascript!);
|
|
@@ -7,7 +11,7 @@ import getType from "./getType";
|
|
|
7
11
|
* @category is
|
|
8
12
|
* @throws {TypeError} Will throw type error if type is an invalid type
|
|
9
13
|
*/
|
|
10
|
-
|
|
14
|
+
function isType(payload, type) {
|
|
11
15
|
if (!(type instanceof Function)) {
|
|
12
16
|
throw new TypeError("Type must be a function");
|
|
13
17
|
}
|
|
@@ -16,7 +20,8 @@ export function isType(payload, type) {
|
|
|
16
20
|
}
|
|
17
21
|
// Classes usually have names (as functions usually have names)
|
|
18
22
|
var name = type.name;
|
|
19
|
-
return (
|
|
23
|
+
return ((0, getType_1.default)(payload) === name ||
|
|
20
24
|
Boolean(payload && payload.constructor === type));
|
|
21
25
|
}
|
|
22
|
-
|
|
26
|
+
exports.isType = isType;
|
|
27
|
+
exports.default = isType;
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isType = void 0;
|
|
4
|
-
var tslib_1 = require("tslib");
|
|
5
|
-
var getType_1 = tslib_1.__importDefault(require("./getType"));
|
|
1
|
+
import getType from "./getType";
|
|
6
2
|
/**
|
|
7
3
|
* Does a generic check to check that the given payload is of a given type.
|
|
8
4
|
* In cases like Number, it will return true for NaN as NaN is a Number (thanks javascript!);
|
|
@@ -11,7 +7,7 @@ var getType_1 = tslib_1.__importDefault(require("./getType"));
|
|
|
11
7
|
* @category is
|
|
12
8
|
* @throws {TypeError} Will throw type error if type is an invalid type
|
|
13
9
|
*/
|
|
14
|
-
function isType(payload, type) {
|
|
10
|
+
export function isType(payload, type) {
|
|
15
11
|
if (!(type instanceof Function)) {
|
|
16
12
|
throw new TypeError("Type must be a function");
|
|
17
13
|
}
|
|
@@ -20,8 +16,7 @@ function isType(payload, type) {
|
|
|
20
16
|
}
|
|
21
17
|
// Classes usually have names (as functions usually have names)
|
|
22
18
|
var name = type.name;
|
|
23
|
-
return ((
|
|
19
|
+
return (getType(payload) === name ||
|
|
24
20
|
Boolean(payload && payload.constructor === type));
|
|
25
21
|
}
|
|
26
|
-
|
|
27
|
-
exports.default = isType;
|
|
22
|
+
export default isType;
|
package/isUndefined.js
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isUndefined = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var getType_1 = tslib_1.__importDefault(require("./getType"));
|
|
2
6
|
/**
|
|
3
7
|
* Returns whether the payload is undefined
|
|
4
8
|
*
|
|
5
9
|
* @category is
|
|
6
10
|
*/
|
|
7
|
-
|
|
8
|
-
return
|
|
11
|
+
function isUndefined(payload) {
|
|
12
|
+
return (0, getType_1.default)(payload) === "Undefined";
|
|
9
13
|
}
|
|
10
|
-
|
|
14
|
+
exports.isUndefined = isUndefined;
|
|
15
|
+
exports.default = isUndefined;
|
package/isUndefined.mjs
ADDED
package/isWeakMap.js
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isWeakMap = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var getType_1 = tslib_1.__importDefault(require("./getType"));
|
|
2
6
|
/**
|
|
3
7
|
* Returns whether the payload is a WeakMap
|
|
4
8
|
*
|
|
5
9
|
* @category is
|
|
6
10
|
*/
|
|
7
|
-
|
|
8
|
-
return
|
|
11
|
+
function isWeakMap(payload) {
|
|
12
|
+
return (0, getType_1.default)(payload) === "WeakMap";
|
|
9
13
|
}
|
|
10
|
-
|
|
14
|
+
exports.isWeakMap = isWeakMap;
|
|
15
|
+
exports.default = isWeakMap;
|
package/isWeakMap.mjs
ADDED
package/isWeakSet.js
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isWeakSet = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var getType_1 = tslib_1.__importDefault(require("./getType"));
|
|
2
6
|
/**
|
|
3
7
|
* Returns whether the payload is a WeakSet
|
|
4
8
|
*
|
|
5
9
|
* @category is
|
|
6
10
|
*/
|
|
7
|
-
|
|
8
|
-
return
|
|
11
|
+
function isWeakSet(payload) {
|
|
12
|
+
return (0, getType_1.default)(payload) === "WeakSet";
|
|
9
13
|
}
|
|
10
|
-
|
|
14
|
+
exports.isWeakSet = isWeakSet;
|
|
15
|
+
exports.default = isWeakSet;
|
package/isWeakSet.mjs
ADDED
package/kbToBytes.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.kbToBytes = void 0;
|
|
1
4
|
/**
|
|
2
5
|
* Kilobytes to bytes
|
|
3
6
|
*
|
|
4
7
|
* @category format
|
|
5
8
|
*/
|
|
6
|
-
|
|
7
|
-
|
|
9
|
+
var kbToBytes = function (bytes) { return bytes * 1000; };
|
|
10
|
+
exports.kbToBytes = kbToBytes;
|
|
11
|
+
exports.default = exports.kbToBytes;
|
package/kbToBytes.mjs
ADDED
package/location.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
package/location.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/lowercase.js
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.lowercase = void 0;
|
|
1
4
|
/**
|
|
2
5
|
* Replacement for native `toLowercase` tyescript ready (type narrowing ready)
|
|
3
6
|
*
|
|
4
7
|
* @category native
|
|
5
8
|
*/
|
|
6
|
-
|
|
9
|
+
var lowercase = function (str) {
|
|
7
10
|
return (str || "").toLowerCase();
|
|
8
11
|
};
|
|
9
|
-
|
|
12
|
+
exports.lowercase = lowercase;
|
|
13
|
+
exports.default = exports.lowercase;
|