const nativeIsArray = Array.isArray;
const ObjProto = Object.prototype;
export const hasOwnProperty = ObjProto.hasOwnProperty;
const toString = ObjProto.toString;
export const isArray = nativeIsArray ||
    function (obj) {
        return toString.call(obj) === '[object Array]';
    };
export const isUint8Array = function (x) {
    return toString.call(x) === '[object Uint8Array]';
};
// from a comment on http://dbj.org/dbj/?p=286
// fails on only one very rare and deliberate custom object:
// let bomb = { toString : undefined, valueOf: function(o) { return "function BOMBA!"; }};
export const isFunction = function (f) {
    return typeof f === 'function';
};
// Underscore Addons
export const isObject = function (x) {
    return x === Object(x) && !isArray(x);
};
export const isEmptyObject = function (x) {
    if (isObject(x)) {
        for (const key in x) {
            if (hasOwnProperty.call(x, key)) {
                return false;
            }
        }
        return true;
    }
    return false;
};
export const isUndefined = function (x) {
    return x === void 0;
};
export const isString = function (x) {
    return toString.call(x) == '[object String]';
};
export const isEmptyString = function (x) {
    var _a;
    return isString(x) && ((_a = x.trim()) === null || _a === void 0 ? void 0 : _a.length) === 0;
};
export const isNull = function (x) {
    return x === null;
};
/*
    sometimes you want to check if something is null or undefined
    that's what this is for
 */
export const isNullish = function (x) {
    return isUndefined(x) || isNull(x);
};
export const isDate = function (x) {
    return toString.call(x) == '[object Date]';
};
export const isNumber = function (x) {
    return toString.call(x) == '[object Number]';
};
export const isBoolean = function (x) {
    return toString.call(x) === '[object Boolean]';
};
export const isDocument = (x) => {
    return x instanceof Document;
};
export const isFormData = (x) => {
    return x instanceof FormData;
};
export const isFile = (x) => {
    return x instanceof File;
};
//# sourceMappingURL=type-utils.js.map