@newdash/newdash
Version:
javascript/typescript utility library
35 lines (34 loc) • 966 B
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.isSymbol = void 0;
const getTag_1 = __importDefault(require("./.internal/getTag"));
const isObjectLike_1 = __importDefault(require("./isObjectLike"));
/**
* @ignore
*/
const symbolTag = "[object Symbol]";
/**
* Checks if `value` is classified as a `Symbol` primitive or object.
*
* @since 5.5.0
* @category Lang
* @param value The value to check.
* @returns Returns `true` if `value` is a symbol, else `false`.
* @example
*
* ```js
* isSymbol(Symbol.iterator)
* // => true
*
* isSymbol('abc')
* // => false
* ```
*/
function isSymbol(value) {
return typeof value == "symbol" || ((0, isObjectLike_1.default)(value) && (0, getTag_1.default)(value) == symbolTag);
}
exports.isSymbol = isSymbol;
exports.default = isSymbol;