Skip to content

Commit

Permalink
don't create an empty object when no process
Browse files Browse the repository at this point in the history
This is also more readable in my opinion.
  • Loading branch information
TooTallNate committed Nov 10, 2016
1 parent 1c6f458 commit a746d52
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ function load() {
} catch(e) {}

// If debug isn't set in LS, and we're in Electron, try to load $DEBUG
if ('env' in (typeof process === 'undefined' ? {} : process)) {
if (typeof process !== 'undefined' && 'env' in process) {
r = process.env.DEBUG;
}

Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* treat as a browser.
*/

if ((typeof process === 'undefined' ? {} : process).type === 'renderer') {
if (typeof process !== 'undefined' && process.type === 'renderer') {
module.exports = require('./browser.js');
} else {
module.exports = require('./node.js');
Expand Down

1 comment on commit a746d52

@jahed
Copy link

@jahed jahed commented on a746d52 Nov 11, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not work for Browser environments where there is no process and so ends up requiring the Node packages and fails miserably. Doesn't it need to be:

typeof process === 'undefined' || process.type === 'renderer'

If so, I've sent a PR #328

Please sign in to comment.