From f03b3edca4faecf07e45a5c495eb510ff73b78dc Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Sun, 23 Apr 2017 22:15:51 -0700 Subject: [PATCH] Update object checks. --- .internal/cloneBuffer.js | 4 ++-- .internal/freeGlobal.js | 2 +- .internal/nodeUtil.js | 4 ++-- .internal/root.js | 2 +- isArguments.js | 2 +- isBuffer.js | 4 ++-- isObjectLike.js | 2 +- isSet.js | 2 +- isTypedArray.js | 2 +- isWeakMap.js | 2 +- isWeakSet.js | 2 +- 11 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.internal/cloneBuffer.js b/.internal/cloneBuffer.js index 37b524171..8aeecd545 100644 --- a/.internal/cloneBuffer.js +++ b/.internal/cloneBuffer.js @@ -1,10 +1,10 @@ import root from './root.js' /** 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`. */ -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`. */ const moduleExports = freeModule && freeModule.exports === freeExports diff --git a/.internal/freeGlobal.js b/.internal/freeGlobal.js index ef2e2da47..7b0963c24 100644 --- a/.internal/freeGlobal.js +++ b/.internal/freeGlobal.js @@ -1,4 +1,4 @@ /** 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 diff --git a/.internal/nodeUtil.js b/.internal/nodeUtil.js index d684732e9..fbc31ba04 100644 --- a/.internal/nodeUtil.js +++ b/.internal/nodeUtil.js @@ -1,10 +1,10 @@ import freeGlobal from './freeGlobal.js' /** 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`. */ -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`. */ const moduleExports = freeModule && freeModule.exports === freeExports diff --git a/.internal/root.js b/.internal/root.js index b0dd49267..8a4324d20 100644 --- a/.internal/root.js +++ b/.internal/root.js @@ -1,7 +1,7 @@ import freeGlobal from './freeGlobal.js' /** 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. */ const root = freeGlobal || freeSelf || Function('return this')() diff --git a/isArguments.js b/isArguments.js index 6e2961242..abee6554d 100644 --- a/isArguments.js +++ b/isArguments.js @@ -16,7 +16,7 @@ import getTag from './.internal/getTag.js' * // => false */ 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 diff --git a/isBuffer.js b/isBuffer.js index 82f63c600..418a30c58 100644 --- a/isBuffer.js +++ b/isBuffer.js @@ -1,10 +1,10 @@ import root from './.internal/root.js' /** 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`. */ -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`. */ const moduleExports = freeModule && freeModule.exports === freeExports diff --git a/isObjectLike.js b/isObjectLike.js index 8fead699a..2e575ded5 100644 --- a/isObjectLike.js +++ b/isObjectLike.js @@ -21,7 +21,7 @@ * // => false */ function isObjectLike(value) { - return value != null && typeof value == 'object' + return typeof value == 'object' && value !== null } export default isObjectLike diff --git a/isSet.js b/isSet.js index 6b8606c62..3314cca71 100644 --- a/isSet.js +++ b/isSet.js @@ -21,6 +21,6 @@ const nodeIsSet = nodeUtil && nodeUtil.isSet */ const isSet = nodeIsSet ? (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 diff --git a/isTypedArray.js b/isTypedArray.js index d39ccfcce..9d2bf2a51 100644 --- a/isTypedArray.js +++ b/isTypedArray.js @@ -24,6 +24,6 @@ const nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray */ const isTypedArray = nodeIsTypedArray ? (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 diff --git a/isWeakMap.js b/isWeakMap.js index 0f9dd8163..6cdbe1dfa 100644 --- a/isWeakMap.js +++ b/isWeakMap.js @@ -16,7 +16,7 @@ import getTag from './.internal/getTag.js' * // => false */ 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 diff --git a/isWeakSet.js b/isWeakSet.js index 24b1322b8..339f50257 100644 --- a/isWeakSet.js +++ b/isWeakSet.js @@ -16,7 +16,7 @@ import getTag from './.internal/getTag.js' * // => false */ 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