browser-or-node
Advanced tools
Comparing version 1.1.0 to 1.2.1
@@ -6,9 +6,17 @@ 'use strict'; | ||
}); | ||
/* global window */ | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
/* global window self */ | ||
var isBrowser = typeof window !== 'undefined' && typeof window.document !== 'undefined'; | ||
/* eslint-disable no-restricted-globals */ | ||
var isWebWorker = (typeof self === 'undefined' ? 'undefined' : _typeof(self)) === 'object' && self.constructor && self.constructor.name === 'DedicatedWorkerGlobalScope'; | ||
/* eslint-enable no-restricted-globals */ | ||
var isNode = typeof process !== 'undefined' && process.versions != null && process.versions.node != null; | ||
exports.isBrowser = isBrowser; | ||
exports.isWebWorker = isWebWorker; | ||
exports.isNode = isNode; |
{ | ||
"name": "browser-or-node", | ||
"version": "1.1.0", | ||
"version": "1.2.1", | ||
"description": "Check where the code is running in the browser or node.js", | ||
@@ -34,2 +34,5 @@ "main": "./lib/index.js", | ||
"author": "Dineshkumar Pandiyan <flexdinesh@gmail.com>", | ||
"contributors": [ | ||
"Daniel Wang <daniel.liberated@gmail.com> (https://github.com/dan1wang/)" | ||
], | ||
"license": "MIT", | ||
@@ -36,0 +39,0 @@ "bugs": { |
@@ -0,0 +0,0 @@ # Browser or Node.js |
@@ -1,5 +0,12 @@ | ||
/* global window */ | ||
/* global window self */ | ||
const isBrowser = typeof window !== 'undefined' && typeof window.document !== 'undefined'; | ||
/* eslint-disable no-restricted-globals */ | ||
const isWebWorker = | ||
typeof self === 'object' && | ||
self.constructor && | ||
self.constructor.name === 'DedicatedWorkerGlobalScope'; | ||
/* eslint-enable no-restricted-globals */ | ||
const isNode = | ||
@@ -12,3 +19,4 @@ typeof process !== 'undefined' && | ||
isBrowser, | ||
isWebWorker, | ||
isNode | ||
}; |
Sorry, the diff of this file is not supported yet
5297
30