All files / utils/dist is.js

72.73% Statements 16/22
10% Branches 1/10
71.43% Functions 5/7
72.73% Lines 16/22

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57  9x 9x 9x   99x 38x     9x                           1x               1x     9x       9x       9x   1x 1x           9x   1x   9x  
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isExistProperty = exports.isInstanceOf = exports.isEmpty = exports.isEmptyObject = exports.isError = exports.variableTypeDetection = exports.nativeToString = void 0;
exports.nativeToString = Object.prototype.toString;
function isType(type) {
    return function (value) {
        return exports.nativeToString.call(value) === "[object " + type + "]";
    };
}
exports.variableTypeDetection = {
    isNumber: isType('Number'),
    isString: isType('String'),
    isBoolean: isType('Boolean'),
    isNull: isType('Null'),
    isUndefined: isType('Undefined'),
    isSymbol: isType('Symbol'),
    isFunction: isType('Function'),
    isObject: isType('Object'),
    isArray: isType('Array'),
    isProcess: isType('process'),
    isWindow: isType('Window')
};
function isError(wat) {
    switch (exports.nativeToString.call(wat)) {
        case '[object Error]':
            return true;
        case '[object Exception]':
            return true;
        case '[object DOMException]':
            return true;
        default:
            return isInstanceOf(wat, Error);
    }
}
exports.isError = isError;
function isEmptyObject(obj) {
    return exports.variableTypeDetection.isObject(obj) && Object.keys(obj).length === 0;
}
exports.isEmptyObject = isEmptyObject;
function isEmpty(wat) {
    return (exports.variableTypeDetection.isString(wat) && wat.trim() === '') || wat === undefined || wat === null;
}
exports.isEmpty = isEmpty;
function isInstanceOf(wat, base) {
    try {
        return wat instanceof base;
    }
    catch (_e) {
        return false;
    }
}
exports.isInstanceOf = isInstanceOf;
function isExistProperty(obj, key) {
    return obj.hasOwnProperty(key);
}
exports.isExistProperty = isExistProperty;
//# sourceMappingURL=is.js.map