mirror of
https://github.com/swc-project/swc.git
synced 2024-12-20 20:22:26 +03:00
27 lines
639 B
TypeScript
27 lines
639 B
TypeScript
|
// Loaded from https://raw.githubusercontent.com/lodash/lodash/master/isSymbol.js
|
||
|
|
||
|
|
||
|
import getTag from './.internal/getTag.js'
|
||
|
|
||
|
/**
|
||
|
* Checks if `value` is classified as a `Symbol` primitive or object.
|
||
|
*
|
||
|
* @since 4.0.0
|
||
|
* @category Lang
|
||
|
* @param {*} value The value to check.
|
||
|
* @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
|
||
|
* @example
|
||
|
*
|
||
|
* isSymbol(Symbol.iterator)
|
||
|
* // => true
|
||
|
*
|
||
|
* isSymbol('abc')
|
||
|
* // => false
|
||
|
*/
|
||
|
function isSymbol(value) {
|
||
|
const type = typeof value
|
||
|
return type == 'symbol' || (type === 'object' && value != null && getTag(value) == '[object Symbol]')
|
||
|
}
|
||
|
|
||
|
export default isSymbol
|