aboutsummaryrefslogtreecommitdiff
path: root/node_modules/@sinonjs/commons/lib/global.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/@sinonjs/commons/lib/global.js')
-rw-r--r--node_modules/@sinonjs/commons/lib/global.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/node_modules/@sinonjs/commons/lib/global.js b/node_modules/@sinonjs/commons/lib/global.js
new file mode 100644
index 0000000..51715a2
--- /dev/null
+++ b/node_modules/@sinonjs/commons/lib/global.js
@@ -0,0 +1,22 @@
+"use strict";
+
+/**
+ * A reference to the global object
+ *
+ * @type {object} globalObject
+ */
+var globalObject;
+
+/* istanbul ignore else */
+if (typeof global !== "undefined") {
+ // Node
+ globalObject = global;
+} else if (typeof window !== "undefined") {
+ // Browser
+ globalObject = window;
+} else {
+ // WebWorker
+ globalObject = self;
+}
+
+module.exports = globalObject;