Update object checks.

This commit is contained in:
John-David Dalton
2017-04-23 22:15:51 -07:00
parent a6019d5316
commit f03b3edca4
11 changed files with 14 additions and 14 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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')()

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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