mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-10 02:47:50 +00:00
Update builds and docs.
Former-commit-id: 57709d874ed5b6855daf536c2a0977738665c3c1
This commit is contained in:
39
dist/lodash.js
vendored
39
dist/lodash.js
vendored
@@ -62,6 +62,13 @@
|
||||
/** Used to match unescaped characters in compiled string literals */
|
||||
var reUnescapedString = /['\n\r\t\u2028\u2029\\]/g;
|
||||
|
||||
/** Used to assign default `context` object properties */
|
||||
var contextProps = [
|
||||
'Array', 'Boolean', 'Date', 'Function', 'Math', 'Number', 'Object', 'RegExp',
|
||||
'String', '_', 'attachEvent', 'clearTimeout', 'isFinite', 'isNaN', 'parseInt',
|
||||
'setImmediate', 'setTimeout', 'toString'
|
||||
];
|
||||
|
||||
/** Used to make template sourceURLs easier to identify */
|
||||
var templateCounter = 0;
|
||||
|
||||
@@ -117,7 +124,7 @@
|
||||
* @returns {Function} Returns the `lodash` function.
|
||||
*/
|
||||
function runInContext(context) {
|
||||
context = context ? _.extend(createObject(window), context) : window;
|
||||
context = context ? _.defaults({}, context, _.pick(window, contextProps)) : window;
|
||||
|
||||
/** Native constructor references */
|
||||
var Array = context.Array,
|
||||
@@ -168,7 +175,7 @@
|
||||
nativeRandom = Math.random;
|
||||
|
||||
/** Detect various environments */
|
||||
var isIeOpera = !!context.attachEvent,
|
||||
var isIeOpera = reNative.test(context.attachEvent),
|
||||
isJSC = !/\n{2,}/.test(Function()),
|
||||
isV8 = nativeBind && !/\n|true/.test(nativeBind + isIeOpera);
|
||||
|
||||
@@ -508,7 +515,9 @@
|
||||
}
|
||||
if (this instanceof bound) {
|
||||
// ensure `new bound` is an instance of `func`
|
||||
thisBinding = createObject(func.prototype);
|
||||
noop.prototype = func.prototype;
|
||||
thisBinding = new noop;
|
||||
noop.prototype = null;
|
||||
|
||||
// mimic the constructor's `return` behavior
|
||||
// http://es5.github.com/#x13.2.2
|
||||
@@ -589,7 +598,6 @@
|
||||
* top - A string of code to execute before the iteration branches.
|
||||
* loop - A string of code to execute in the object loop.
|
||||
* bottom - A string of code to execute after the iteration branches.
|
||||
*
|
||||
* @returns {Function} Returns the compiled function.
|
||||
*/
|
||||
function createIterator() {
|
||||
@@ -627,20 +635,6 @@
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new object that inherits from the given `prototype` object.
|
||||
*
|
||||
* @private
|
||||
* @param {Object} prototype The prototype object.
|
||||
* @returns {Object} Returns the new object.
|
||||
*/
|
||||
function createObject(prototype) {
|
||||
noop.prototype = prototype;
|
||||
var result = new noop;
|
||||
noop.prototype = null;
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* A function compiled to iterate `arguments` objects, arrays, objects, and
|
||||
* strings consistenly across environments, executing the `callback` for each
|
||||
@@ -1961,9 +1955,9 @@
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the given `value` into an integer of the specified `radix`.
|
||||
* Converts the given `value` into an integer of the specified `radix`.
|
||||
*
|
||||
* Note: This method avoids differences in ES3 and ES5 `parseInt`
|
||||
* Note: This method avoids differences in native ES3 and ES5 `parseInt`
|
||||
* implementations. See http://es5.github.com/#E.
|
||||
*
|
||||
* @static
|
||||
@@ -1977,7 +1971,7 @@
|
||||
* // => 8
|
||||
*/
|
||||
var parseInt = nativeParseInt('08') == 8 ? nativeParseInt : function(value, radix) {
|
||||
// Firefox and Opera have not changed to the ES5 specified implementation of `parseInt`
|
||||
// Firefox and Opera still follow the ES3 specified implementation of `parseInt`
|
||||
return nativeParseInt(isString(value) ? value.replace(/^0+(?=.$)/, '') : value, radix || 0);
|
||||
};
|
||||
|
||||
@@ -4525,7 +4519,6 @@
|
||||
* interpolate - The "interpolate" delimiter regexp.
|
||||
* sourceURL - The sourceURL of the template's compiled source.
|
||||
* variable - The data object variable name.
|
||||
*
|
||||
* @returns {Function|String} Returns a compiled function when no `data` object
|
||||
* is given, else it returns the interpolated text.
|
||||
* @example
|
||||
@@ -5039,7 +5032,7 @@
|
||||
});
|
||||
}
|
||||
// check for `exports` after `define` in case a build optimizer adds an `exports` object
|
||||
else if (freeExports) {
|
||||
else if (freeExports && !freeExports.nodeType) {
|
||||
// in Node.js or RingoJS v0.8.0+
|
||||
if (freeModule) {
|
||||
(freeModule.exports = _)._ = _;
|
||||
|
||||
Reference in New Issue
Block a user