Merge pull request #10228 from morille/patch-2

Don't detect nw.js as node.js
This commit is contained in:
Tim van der Meij 2018-11-07 23:51:01 +01:00 committed by GitHub
commit 3e342554d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -15,5 +15,9 @@
/* globals module, process */
module.exports = function isNodeJS() {
return typeof process === 'object' && process + '' === '[object process]';
// NW.js is a browser context, but copies some Node.js objects; see
// http://docs.nwjs.io/en/latest/For%20Users/Advanced/JavaScript%20Contexts%20in%20NW.js/#access-nodejs-and-nwjs-api-in-browser-context
return typeof process === 'object' &&
process + '' === '[object process]' &&
!process.versions['nw'];
};