diff options
author | Rebecca Turner <me@re-becca.org> | 2016-02-04 04:50:13 +0300 |
---|---|---|
committer | Rebecca Turner <me@re-becca.org> | 2016-02-04 04:54:49 +0300 |
commit | 0a94bf6af0ebd38d080f92257e0cd9bae40b31ff (patch) | |
tree | c83d836b44ef02c45798adb51c25e8ab84147f03 /node_modules/lodash.union/index.js | |
parent | b4c9582b4ef5991f3d155e0c6142ed1c631860af (diff) |
lodash.union@4.0.2
Browser compatibility fixes.
Credit: @jdalton
Diffstat (limited to 'node_modules/lodash.union/index.js')
-rw-r--r-- | node_modules/lodash.union/index.js | 53 |
1 files changed, 47 insertions, 6 deletions
diff --git a/node_modules/lodash.union/index.js b/node_modules/lodash.union/index.js index 8e4570557..ab0637bba 100644 --- a/node_modules/lodash.union/index.js +++ b/node_modules/lodash.union/index.js @@ -1,5 +1,5 @@ /** - * lodash 4.0.0 (Custom Build) <https://lodash.com/> + * lodash 4.0.2 (Custom Build) <https://lodash.com/> * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/> * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> @@ -26,6 +26,49 @@ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; /** Used to detect host constructors (Safari > 5). */ var reIsHostCtor = /^\[object .+?Constructor\]$/; +/** Used to determine if values are of the language type `Object`. */ +var objectTypes = { + 'function': true, + 'object': true +}; + +/** Detect free variable `exports`. */ +var freeExports = (objectTypes[typeof exports] && exports && !exports.nodeType) ? exports : null; + +/** Detect free variable `module`. */ +var freeModule = (objectTypes[typeof module] && module && !module.nodeType) ? module : null; + +/** Detect free variable `global` from Node.js. */ +var freeGlobal = checkGlobal(freeExports && freeModule && typeof global == 'object' && global); + +/** Detect free variable `self`. */ +var freeSelf = checkGlobal(objectTypes[typeof self] && self); + +/** Detect free variable `window`. */ +var freeWindow = checkGlobal(objectTypes[typeof window] && window); + +/** Detect `this` as the global object. */ +var thisGlobal = checkGlobal(objectTypes[typeof this] && this); + +/** + * Used as a reference to the global object. + * + * The `this` value is used if it's the global object to avoid Greasemonkey's + * restricted `window` object, otherwise the `window` object is used. + */ +var root = freeGlobal || ((freeWindow !== (thisGlobal && thisGlobal.window)) && freeWindow) || freeSelf || thisGlobal || Function('return this')(); + +/** + * Checks if `value` is a global object. + * + * @private + * @param {*} value The value to check. + * @returns {null|Object} Returns `value` if it's a global object, else `null`. + */ +function checkGlobal(value) { + return (value && value.Object === Object) ? value : null; +} + /** * Checks if `value` is a host object in IE < 9. * @@ -63,10 +106,10 @@ function setToArray(set) { } /** Used for built-in method references. */ -var objectProto = global.Object.prototype; +var objectProto = Object.prototype; /** Used to resolve the decompiled source of functions. */ -var funcToString = global.Function.prototype.toString; +var funcToString = Function.prototype.toString; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; @@ -84,7 +127,7 @@ var reIsNative = RegExp('^' + ); /* Built-in method references that are verified to be native. */ -var Set = getNative(global, 'Set'); +var Set = getNative(root, 'Set'); /** * The base implementation of `_.uniqBy` without support for iteratee shorthands. @@ -237,8 +280,6 @@ function isFunction(value) { * // => false */ function isObject(value) { - // Avoid a V8 JIT bug in Chrome 19-20. - // See https://code.google.com/p/v8/issues/detail?id=2291 for more details. var type = typeof value; return !!value && (type == 'object' || type == 'function'); } |