mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-10 02:47:50 +00:00
This commit is contained in:
committed by
John-David Dalton
parent
6cb1f71adf
commit
c77650a17b
@@ -1,7 +1,4 @@
|
|||||||
const objectProto = Object.prototype
|
const toString = Object.prototype.toString
|
||||||
const hasOwnProperty = objectProto.hasOwnProperty
|
|
||||||
const toString = objectProto.toString
|
|
||||||
const symToStringTag = Symbol.toStringTag
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The base implementation of `getTag` without fallbacks for buggy environments.
|
* The base implementation of `getTag` without fallbacks for buggy environments.
|
||||||
@@ -14,26 +11,7 @@ function baseGetTag(value) {
|
|||||||
if (value == null) {
|
if (value == null) {
|
||||||
return value === undefined ? '[object Undefined]' : '[object Null]'
|
return value === undefined ? '[object Undefined]' : '[object Null]'
|
||||||
}
|
}
|
||||||
if (!(symToStringTag in Object(value))) {
|
return toString.call(value)
|
||||||
return toString.call(value)
|
|
||||||
}
|
|
||||||
const isOwn = hasOwnProperty.call(value, symToStringTag)
|
|
||||||
const tag = value[symToStringTag]
|
|
||||||
let unmasked = false
|
|
||||||
try {
|
|
||||||
value[symToStringTag] = undefined
|
|
||||||
unmasked = true
|
|
||||||
} catch (e) {}
|
|
||||||
|
|
||||||
const result = toString.call(value)
|
|
||||||
if (unmasked) {
|
|
||||||
if (isOwn) {
|
|
||||||
value[symToStringTag] = tag
|
|
||||||
} else {
|
|
||||||
delete value[symToStringTag]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default baseGetTag
|
export default baseGetTag
|
||||||
|
|||||||
Reference in New Issue
Block a user