diff --git a/lib/main.js b/lib/main.js index cef3019..e52557b 100644 --- a/lib/main.js +++ b/lib/main.js @@ -49,7 +49,7 @@ var RE = /node|io\.js/; function isNode() { return ( // Check for presence of `global` variable: - typeof global === 'object' && + (typeof global === 'object' && // Check that the `global` variable matches the determined global variable: global === Global && @@ -60,10 +60,8 @@ function isNode() { // Check that the global variable has the expected internal class: ( // Node < v7 - nativeClass( Global ) === '[object global]' || - - // Node >= v7 (https://github.com/nodejs/node/issues/9274) - nativeClass( Global ) === '[object Object]' + (nativeClass( Global ) === '[object global]' || // Node >= v7 (https://github.com/nodejs/node/issues/9274) + nativeClass( Global ) === '[object Object]') ) && // Check that the `global` variable is equal to the global scope: @@ -82,23 +80,16 @@ function isNode() { isObject( proc.versions ) && // Check for a `node` property: - isString( proc.versions.node ) && - - ( - // `process.release` was added in Node v3.0.0 via io.js: - typeof proc.release === 'undefined' || // eslint-disable-line n/no-unsupported-features/node-builtins - - ( - // Check for a `release` property: - isObject( proc.release ) && // eslint-disable-line n/no-unsupported-features/node-builtins - - // Check for a `name` property: - isString( proc.release.name ) && // eslint-disable-line n/no-unsupported-features/node-builtins - - // Check that the release name contains either `node` or `io.js` (in Node.js/io.js, the release name is read-only): - RE.test( proc.release.name ) // eslint-disable-line n/no-unsupported-features/node-builtins - ) - ) + isString( proc.versions.node ) && // `process.release` was added in Node v3.0.0 via io.js: + (// eslint-disable-line n/no-unsupported-features/node-builtins + typeof proc.release === 'undefined' || // Check for a `release` property: + // eslint-disable-line n/no-unsupported-features/node-builtins + (// eslint-disable-line n/no-unsupported-features/node-builtins + isObject( proc.release ) && // eslint-disable-line n/no-unsupported-features/node-builtins + + // Check for a `name` property: + isString( proc.release.name ) && // Check that the release name contains either `node` or `io.js` (in Node.js/io.js, the release name is read-only): + RE.test( proc.release.name )))) ); } diff --git a/package.json b/package.json index af2db96..08d175a 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,8 @@ "@stdlib/assert-is-plain-object": "^0.2.3", "@stdlib/assert-is-string": "^0.2.3", "@stdlib/utils-global": "^0.2.3", - "@stdlib/utils-native-class": "^0.2.3" + "@stdlib/utils-native-class": "^0.2.3", + "@stdlib/error-tools-fmtprodmsg": "^0.2.3" }, "devDependencies": { "proxyquire": "^2.0.0", @@ -83,4 +84,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file