Initial commit
[yaffs-website] / node_modules / lodash._root / index.js
1 /**
2  * lodash 3.0.1 (Custom Build) <https://lodash.com/>
3  * Build: `lodash modularize exports="npm" -o ./`
4  * Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/>
5  * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
6  * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
7  * Available under MIT license <https://lodash.com/license>
8  */
9
10 /** Used to determine if values are of the language type `Object`. */
11 var objectTypes = {
12   'function': true,
13   'object': true
14 };
15
16 /** Detect free variable `exports`. */
17 var freeExports = (objectTypes[typeof exports] && exports && !exports.nodeType)
18   ? exports
19   : undefined;
20
21 /** Detect free variable `module`. */
22 var freeModule = (objectTypes[typeof module] && module && !module.nodeType)
23   ? module
24   : undefined;
25
26 /** Detect free variable `global` from Node.js. */
27 var freeGlobal = checkGlobal(freeExports && freeModule && typeof global == 'object' && global);
28
29 /** Detect free variable `self`. */
30 var freeSelf = checkGlobal(objectTypes[typeof self] && self);
31
32 /** Detect free variable `window`. */
33 var freeWindow = checkGlobal(objectTypes[typeof window] && window);
34
35 /** Detect `this` as the global object. */
36 var thisGlobal = checkGlobal(objectTypes[typeof this] && this);
37
38 /**
39  * Used as a reference to the global object.
40  *
41  * The `this` value is used if it's the global object to avoid Greasemonkey's
42  * restricted `window` object, otherwise the `window` object is used.
43  */
44 var root = freeGlobal ||
45   ((freeWindow !== (thisGlobal && thisGlobal.window)) && freeWindow) ||
46     freeSelf || thisGlobal || Function('return this')();
47
48 /**
49  * Checks if `value` is a global object.
50  *
51  * @private
52  * @param {*} value The value to check.
53  * @returns {null|Object} Returns `value` if it's a global object, else `null`.
54  */
55 function checkGlobal(value) {
56   return (value && value.Object === Object) ? value : null;
57 }
58
59 module.exports = root;