mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-08 02:17:48 +00:00
Strengthen the UMD.
This commit is contained in:
33
lodash.js
33
lodash.js
@@ -135,10 +135,13 @@
|
||||
var root = (objectTypes[typeof window] && window) || this;
|
||||
|
||||
/** Detect free variable `exports` */
|
||||
var freeExports = objectTypes[typeof exports] && exports;
|
||||
var freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports;
|
||||
|
||||
/** Detect free variable `module` */
|
||||
var freeModule = objectTypes[typeof module] && module && module.exports == freeExports && module;
|
||||
var freeModule = objectTypes[typeof module] && module && !module.nodeType && module;
|
||||
|
||||
/** Detect the popular CommonJS extension `module.exports` */
|
||||
var moduleExports = freeModule && freeModule.exports === freeExports && freeExports;
|
||||
|
||||
/** Detect free variable `global` from Node.js or Browserified code and use it as `root` */
|
||||
var freeGlobal = objectTypes[typeof global] && global;
|
||||
@@ -733,14 +736,6 @@
|
||||
*/
|
||||
support.funcNames = typeof Function.name == 'string';
|
||||
|
||||
/**
|
||||
* Detect if own properties are iterated after inherited properties (all but IE < 9).
|
||||
*
|
||||
* @memberOf _.support
|
||||
* @type boolean
|
||||
*/
|
||||
support.ownLast = props[0] != 'x';
|
||||
|
||||
/**
|
||||
* Detect if `arguments` object indexes are non-enumerable
|
||||
* (Firefox < 4, IE < 9, PhantomJS, Safari < 5.1).
|
||||
@@ -761,6 +756,14 @@
|
||||
*/
|
||||
support.nonEnumShadows = !/valueOf/.test(props);
|
||||
|
||||
/**
|
||||
* Detect if own properties are iterated after inherited properties (all but IE < 9).
|
||||
*
|
||||
* @memberOf _.support
|
||||
* @type boolean
|
||||
*/
|
||||
support.ownLast = props[0] != 'x';
|
||||
|
||||
/**
|
||||
* Detect if `Array#shift` and `Array#splice` augment array-like objects correctly.
|
||||
*
|
||||
@@ -5566,7 +5569,7 @@
|
||||
return setTimeout(function() { func.apply(undefined, args); }, 1);
|
||||
}
|
||||
// use `setImmediate` if available in Node.js
|
||||
if (isV8 && freeModule && typeof setImmediate == 'function') {
|
||||
if (isV8 && moduleExports && typeof setImmediate == 'function') {
|
||||
defer = function(func) {
|
||||
if (!isFunction(func)) {
|
||||
throw new TypeError;
|
||||
@@ -6698,12 +6701,12 @@
|
||||
});
|
||||
}
|
||||
// check for `exports` after `define` in case a build optimizer adds an `exports` object
|
||||
else if (freeExports && !freeExports.nodeType) {
|
||||
// in Node.js or RingoJS v0.8.0+
|
||||
if (freeModule) {
|
||||
else if (freeExports && freeModule) {
|
||||
// in Node.js or RingoJS
|
||||
if (moduleExports) {
|
||||
(freeModule.exports = _)._ = _;
|
||||
}
|
||||
// in Narwhal or RingoJS v0.7.0-
|
||||
// in Narwhal or Rhino -require
|
||||
else {
|
||||
freeExports._ = _;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user