mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-06 09:47:48 +00:00
wip: migrate to bun
This commit is contained in:
26
src/isSymbol.ts
Normal file
26
src/isSymbol.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
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;
|
||||
Reference in New Issue
Block a user