Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
exotic / dist / types / kind / toKindOf.js
Size: Mime:
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const nil_1 = require("../primitive/nil");
const toObjStringTag_1 = require("./toObjStringTag");
/**
 * @name toKindOf
 * @since 5.0.0-beta.9
 *
 * @param  {*} x any
 * @return {string} objectToStringTag but lowercased & stripped of brackets
 *
 * @see is/toS
 *
 * {@link https://github.com/ramda/ramda/blob/master/src/type.js ramda-type}
 * @see {@link ramda-type}
 *
 * @example toKindOf('stringy') //=> 'String'
 */
const toKindOf = (x, allLowerCase = undefined) => {
    const tag = nil_1.isNull(x)
        ? 'Null'
        : nil_1.isUndefined(x)
            ? 'Undefined'
            : toObjStringTag_1.default(x).slice(8, -1);
    return allLowerCase === true ? tag.toLowerCase() : tag;
    // toObjStringTag(x).replace(/\[|\]|\s+|Object/gim, '').toLowerCase()
    // let asTag = toObjStringTag(x)
    //   .replace('[', '')
    //   .replace(']', '')
    //   .replace('object', '')
    //   .replace('Object', '')
    //   .replace(/\s+/, '')
    // // then was [object Object]
    // if (asTag === '') asTag = 'Object'
    // if (allLowerCase === true) asTag = asTag.toLowerCase()
    // return asTag
};
exports.toKindOf = toKindOf;
exports.default = toKindOf;
//# sourceMappingURL=toKindOf.js.map