mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-05 09:27:49 +00:00
Update object checks.
This commit is contained in:
@@ -1,10 +1,10 @@
|
|||||||
import root from './root.js'
|
import root from './root.js'
|
||||||
|
|
||||||
/** Detect free variable `exports`. */
|
/** Detect free variable `exports`. */
|
||||||
const freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports
|
const freeExports = typeof exports == 'object' && exports !== null && !exports.nodeType && exports
|
||||||
|
|
||||||
/** Detect free variable `module`. */
|
/** Detect free variable `module`. */
|
||||||
const freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module
|
const freeModule = freeExports && typeof module == 'object' && module !== null && !module.nodeType && module
|
||||||
|
|
||||||
/** Detect the popular CommonJS extension `module.exports`. */
|
/** Detect the popular CommonJS extension `module.exports`. */
|
||||||
const moduleExports = freeModule && freeModule.exports === freeExports
|
const moduleExports = freeModule && freeModule.exports === freeExports
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/** Detect free variable `global` from Node.js. */
|
/** Detect free variable `global` from Node.js. */
|
||||||
const freeGlobal = typeof global == 'object' && global && global.Object === Object && global
|
const freeGlobal = typeof global == 'object' && global !== null && global.Object === Object && global
|
||||||
|
|
||||||
export default freeGlobal
|
export default freeGlobal
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import freeGlobal from './freeGlobal.js'
|
import freeGlobal from './freeGlobal.js'
|
||||||
|
|
||||||
/** Detect free variable `exports`. */
|
/** Detect free variable `exports`. */
|
||||||
const freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports
|
const freeExports = typeof exports == 'object' && exports !== null && !exports.nodeType && exports
|
||||||
|
|
||||||
/** Detect free variable `module`. */
|
/** Detect free variable `module`. */
|
||||||
const freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module
|
const freeModule = freeExports && typeof module == 'object' && module !== null && !module.nodeType && module
|
||||||
|
|
||||||
/** Detect the popular CommonJS extension `module.exports`. */
|
/** Detect the popular CommonJS extension `module.exports`. */
|
||||||
const moduleExports = freeModule && freeModule.exports === freeExports
|
const moduleExports = freeModule && freeModule.exports === freeExports
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import freeGlobal from './freeGlobal.js'
|
import freeGlobal from './freeGlobal.js'
|
||||||
|
|
||||||
/** Detect free variable `self`. */
|
/** Detect free variable `self`. */
|
||||||
const freeSelf = typeof self == 'object' && self && self.Object === Object && self
|
const freeSelf = typeof self == 'object' && self !== null && self.Object === Object && self
|
||||||
|
|
||||||
/** Used as a reference to the global object. */
|
/** Used as a reference to the global object. */
|
||||||
const root = freeGlobal || freeSelf || Function('return this')()
|
const root = freeGlobal || freeSelf || Function('return this')()
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import getTag from './.internal/getTag.js'
|
|||||||
* // => false
|
* // => false
|
||||||
*/
|
*/
|
||||||
function isArguments(value) {
|
function isArguments(value) {
|
||||||
return typeof value == 'object' && value != null && getTag(value) == '[object Arguments]'
|
return typeof value == 'object' && value !== null && getTag(value) == '[object Arguments]'
|
||||||
}
|
}
|
||||||
|
|
||||||
export default isArguments
|
export default isArguments
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import root from './.internal/root.js'
|
import root from './.internal/root.js'
|
||||||
|
|
||||||
/** Detect free variable `exports`. */
|
/** Detect free variable `exports`. */
|
||||||
const freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports
|
const freeExports = typeof exports == 'object' && exports !== null && !exports.nodeType && exports
|
||||||
|
|
||||||
/** Detect free variable `module`. */
|
/** Detect free variable `module`. */
|
||||||
const freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module
|
const freeModule = freeExports && typeof module == 'object' && module !== null && !module.nodeType && module
|
||||||
|
|
||||||
/** Detect the popular CommonJS extension `module.exports`. */
|
/** Detect the popular CommonJS extension `module.exports`. */
|
||||||
const moduleExports = freeModule && freeModule.exports === freeExports
|
const moduleExports = freeModule && freeModule.exports === freeExports
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
* // => false
|
* // => false
|
||||||
*/
|
*/
|
||||||
function isObjectLike(value) {
|
function isObjectLike(value) {
|
||||||
return value != null && typeof value == 'object'
|
return typeof value == 'object' && value !== null
|
||||||
}
|
}
|
||||||
|
|
||||||
export default isObjectLike
|
export default isObjectLike
|
||||||
|
|||||||
2
isSet.js
2
isSet.js
@@ -21,6 +21,6 @@ const nodeIsSet = nodeUtil && nodeUtil.isSet
|
|||||||
*/
|
*/
|
||||||
const isSet = nodeIsSet
|
const isSet = nodeIsSet
|
||||||
? (value) => nodeIsSet(value)
|
? (value) => nodeIsSet(value)
|
||||||
: (value) => typeof value == 'object' && value != null && getTag(value) == '[object Set]'
|
: (value) => typeof value == 'object' && value !== null && getTag(value) == '[object Set]'
|
||||||
|
|
||||||
export default isSet
|
export default isSet
|
||||||
|
|||||||
@@ -24,6 +24,6 @@ const nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray
|
|||||||
*/
|
*/
|
||||||
const isTypedArray = nodeIsTypedArray
|
const isTypedArray = nodeIsTypedArray
|
||||||
? (value) => nodeIsTypedArray(value)
|
? (value) => nodeIsTypedArray(value)
|
||||||
: (value) => typeof value == 'object' && value != null && reTypedTag.test(getTag(value))
|
: (value) => typeof value == 'object' && value !== null && reTypedTag.test(getTag(value))
|
||||||
|
|
||||||
export default isTypedArray
|
export default isTypedArray
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import getTag from './.internal/getTag.js'
|
|||||||
* // => false
|
* // => false
|
||||||
*/
|
*/
|
||||||
function isWeakMap(value) {
|
function isWeakMap(value) {
|
||||||
return typeof value == 'object' && value != null && getTag(value) == '[object WeakMap]'
|
return typeof value == 'object' && value !== null && getTag(value) == '[object WeakMap]'
|
||||||
}
|
}
|
||||||
|
|
||||||
export default isWeakMap
|
export default isWeakMap
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import getTag from './.internal/getTag.js'
|
|||||||
* // => false
|
* // => false
|
||||||
*/
|
*/
|
||||||
function isWeakSet(value) {
|
function isWeakSet(value) {
|
||||||
return typeof value == 'object' && value != null && getTag(value) == '[object WeakSet]'
|
return typeof value == 'object' && value !== null && getTag(value) == '[object WeakSet]'
|
||||||
}
|
}
|
||||||
|
|
||||||
export default isWeakSet
|
export default isWeakSet
|
||||||
|
|||||||
Reference in New Issue
Block a user