Rebuild dist.

This commit is contained in:
John-David Dalton
2014-03-26 02:07:08 -07:00
parent 2e57f76c12
commit 540325dc20
6 changed files with 320 additions and 287 deletions

143
dist/lodash.js vendored
View File

@@ -4,7 +4,7 @@
* Build: `lodash modern -o ./dist/lodash.js`
* Copyright 2012-2014 The Dojo Foundation <http://dojofoundation.org/>
* Based on Underscore.js 1.6.0 <http://underscorejs.org/LICENSE>
* Copyright 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
* Copyright 2009-2014 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
* Available under MIT license <http://lodash.com/license>
*/
;(function() {
@@ -50,7 +50,7 @@
*/
var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
/** Used to match regexp flags from their coerced string values */
/** Used to match `RegExp` flags from their coerced string values */
var reFlags = /\w*$/;
/** Used to detected named functions */
@@ -66,8 +66,8 @@
var reNoMatch = /($^)/;
/**
* Used to match RegExp special characters.
* See this [article on RegExp characters](http://www.regular-expressions.info/characters.html#special)
* Used to match `RegExp` special characters.
* See this [article on `RegExp` characters](http://www.regular-expressions.info/characters.html#special)
* for more details.
*/
var reRegExpChars = /[.*+?^${}()|[\]\\]/g;
@@ -100,7 +100,7 @@
'parseInt', 'setTimeout', 'TypeError', 'window', 'WinRTError'
];
/** Used to make template sourceURLs easier to identify */
/** Used to make template `sourceURL`s easier to identify */
var templateCounter = 0;
/** `Object#toString` result shortcuts */
@@ -188,7 +188,7 @@
'\xDF': 'ss', '\xD7': ' ', '\xF7': ' '
};
/** Used to determine if values are of the language type Object */
/** Used to determine if values are of the language type `Object` */
var objectTypes = {
'function': true,
'object': true
@@ -309,6 +309,7 @@
*
* @private
* @param {string} string The string to inspect.
* @param {string} chars The chars to find.
* @returns {number} Returns the index of the first character not found in `chars`.
*/
function charsLeftIndex(string, chars) {
@@ -328,6 +329,7 @@
*
* @private
* @param {string} string The string to inspect.
* @param {string} chars The chars to find.
* @returns {number} Returns the index of the last character not found in `chars`.
*/
function charsRightIndex(string, chars) {
@@ -341,7 +343,7 @@
}
/**
* Used by `sortBy` to compare transformed elements of a collection and stable
* Used by `_.sortBy` to compare transformed elements of a collection and stable
* sort them in ascending order.
*
* @private
@@ -354,7 +356,7 @@
}
/**
* Used by `sortBy` to compare multiple properties of each element in a
* Used by `_.sortBy` to compare multiple properties of each element in a
* collection and stable sort them in ascending order.
*
* @private
@@ -418,7 +420,7 @@
}
/**
* Used by `escape` to convert characters to HTML entities.
* Used by `_.escape` to convert characters to HTML entities.
*
* @private
* @param {string} chr The matched character to escape.
@@ -429,7 +431,7 @@
}
/**
* Used by `template` to escape characters for inclusion in compiled
* Used by `_.template` to escape characters for inclusion in compiled
* string literals.
*
* @private
@@ -441,7 +443,7 @@
}
/**
* A fallback implementation of `trim` to remove leading and trailing
* A fallback implementation of `String#trim` to remove leading and trailing
* whitespace or specified characters from `string`.
*
* @private
@@ -462,7 +464,7 @@
}
/**
* A fallback implementation of `trimLeft` to remove leading whitespace or
* A fallback implementation of `String#trimLeft` to remove leading whitespace or
* specified characters from `string`.
*
* @private
@@ -483,7 +485,7 @@
}
/**
* A fallback implementation of `trimRight` to remove trailing whitespace or
* A fallback implementation of `String#trimRight` to remove trailing whitespace or
* specified characters from `string`.
*
* @private
@@ -544,7 +546,7 @@
}
/**
* Used by `unescape` to convert HTML entities to characters.
* Used by `_.unescape` to convert HTML entities to characters.
*
* @private
* @param {string} chr The matched character to unescape.
@@ -557,7 +559,7 @@
/*--------------------------------------------------------------------------*/
/**
* Create a new `lodash` function using the given context object.
* Create a new `lodash` function using the given `context` object.
*
* @static
* @memberOf _
@@ -592,17 +594,17 @@
/** Used to detect DOM support */
var document = (document = context.window) && document.document;
/** Used to restore the original `_` reference in `noConflict` */
/** Used to restore the original `_` reference in `_.noConflict` */
var oldDash = context._;
/**
* Used as the maximum length an array-like object.
* Used as the maximum length of an array-like object.
* See the [ES6 spec](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength)
* for more details.
*/
var maxSafeInteger = Math.pow(2, 53) - 1;
/** Used to resolve the internal [[Class]] of values */
/** Used to resolve the internal `[[Class]]` of values */
var toString = objectProto.toString;
/** Used to detect if a method is native */
@@ -624,7 +626,7 @@
splice = arrayRef.splice,
unshift = arrayRef.unshift;
/** Used to set meta data on functions */
/** Used to set metadata on functions */
var defineProperty = (function() {
// IE 8 only accepts DOM elements
try {
@@ -651,7 +653,7 @@
nativeTrimLeft = isNative(nativeTrimLeft = stringProto.trimLeft) && !nativeTrimLeft.call(whitespace) && nativeTrimLeft,
nativeTrimRight = isNative(nativeTrimRight = stringProto.trimRight) && !nativeTrimRight.call(whitespace) && nativeTrimRight;
/** Used to lookup a built-in constructor by [[Class]] */
/** Used to lookup a built-in constructor by `[[Class]]` */
var ctorByClass = {};
ctorByClass[arrayClass] = Array;
ctorByClass[boolClass] = Boolean;
@@ -743,7 +745,7 @@
*
* @private
* @param {*} value The value to wrap in a `lodash` instance.
* @param {boolean} [chainAll=false] A flag to enable chaining for all methods
* @param {boolean} [chainAll=false] A flag to enable chaining for all methods.
* @returns {Object} Returns a `lodash` instance.
*/
function lodashWrapper(value, chainAll) {
@@ -856,7 +858,7 @@
/**
* The base implementation of `_.bind` that creates the bound function and
* sets its meta data.
* sets its metadata.
*
* @private
* @param {Array} data The metadata array.
@@ -917,7 +919,7 @@
return result;
}
}
// inspect [[Class]]
// inspect `[[Class]]`
var isObj = isObject(value);
if (isObj) {
var className = toString.call(value);
@@ -1071,7 +1073,7 @@
/**
* The base implementation of `createWrapper` that creates the wrapper and
* sets its meta data.
* sets its metadata.
*
* @private
* @param {Array} data The metadata array.
@@ -1229,7 +1231,7 @@
}
/**
* The base implementation of `find`, 'findLast`, `findKey`, and `findLastKey`
* The base implementation of `_.find`, '_.findLast`, `_.findKey`, and `_.findLastKey`
* without support for callback shorthands or `this` binding which iterates
* over `collection` using the provided `eachFunc`.
*
@@ -1415,7 +1417,7 @@
(valType != 'function' && valType != 'object' && othType != 'function' && othType != 'object'))) {
return false;
}
// compare [[Class]] names
// compare `[[Class]]` names
var valClass = toString.call(value),
othClass = toString.call(other),
valIsArg = valClass == argsClass,
@@ -1996,7 +1998,7 @@
};
/**
* A fallback implementation of `isPlainObject` which checks if `value` is
* A fallback implementation of `_.isPlainObject` which checks if `value` is
* an object created by the `Object` constructor, assuming objects created
* by the `Object` constructor have no inherited enumerable properties and
* that there are no `Object.prototype` extensions.
@@ -2036,11 +2038,17 @@
var index = -1,
props = keysIn(object),
length = props.length,
objLength = length && object.length,
result = [];
if (typeof objLength == 'number' && objLength > 0) {
var allowIndexes = isArray(object),
maxIndex = objLength - 1;
}
while (++index < length) {
var key = props[index];
if (hasOwnProperty.call(object, key)) {
if ((allowIndexes && key > -1 && key <= maxIndex && key % 1 == 0) ||
hasOwnProperty.call(object, key)) {
result.push(key);
}
}
@@ -2093,8 +2101,8 @@
* _.difference([1, 2, 3], [5, 2, 10]);
* // => [1, 3]
*/
function difference(array) {
return baseDifference(array, baseFlatten(arguments, true, true, 1));
function difference() {
return baseDifference(arguments[0], baseFlatten(arguments, true, true, 1));
}
/**
@@ -2531,46 +2539,43 @@
* _.intersection([1, 2, 3], [5, 2, 1, 4], [2, 1]);
* // => [1, 2]
*/
function intersection(array) {
if (!array) {
return [];
}
function intersection() {
var args = [],
argsIndex = -1,
argsLength = arguments.length,
caches = [],
indexOf = getIndexOf(),
prereq = createCache && indexOf === baseIndexOf,
seen = [];
prereq = createCache && indexOf === baseIndexOf;
while (++argsIndex < argsLength) {
var value = arguments[argsIndex];
if (isArray(value) || isArguments(value)) {
args.push(value);
caches.push(prereq && value.length >= 120 &&
createCache(argsIndex ? value : seen));
createCache(argsIndex && value));
}
}
argsLength = args.length;
var array = args[0],
index = -1,
length = array ? array.length : 0,
result = [];
result = [],
seen = caches[0];
outer:
while (++index < length) {
var cache = caches[0];
value = array[index];
if ((cache ? cacheIndexOf(cache, value) : indexOf(seen, value)) < 0) {
if ((seen ? cacheIndexOf(seen, value) : indexOf(result, value)) < 0) {
argsIndex = argsLength;
(cache || seen).push(value);
while (--argsIndex) {
cache = caches[argsIndex];
var cache = caches[argsIndex];
if ((cache ? cacheIndexOf(cache, value) : indexOf(args[argsIndex], value)) < 0) {
continue outer;
}
}
if (seen) {
seen.push(value);
}
result.push(value);
}
}
@@ -3248,9 +3253,7 @@
* // => 'pebbles is 1'
*/
function chain(value) {
value = new lodashWrapper(value);
value.__chain__ = true;
return value;
return new lodashWrapper(value, true);
}
/**
@@ -4726,7 +4729,7 @@
* @static
* @memberOf _
* @category Functions
* @param {...Function} [func] Functions to compose.
* @param {...Function} [funcs] Functions to compose.
* @returns {Function} Returns the new composed function.
* @example
*
@@ -4812,7 +4815,7 @@
* the leading and/or trailing edge of the `wait` timeout. Subsequent calls
* to the debounced function will return the result of the last `func` call.
*
* Note: If `leading` and `trailing` options are `true` `func` will be called
* Note: If `leading` and `trailing` options are `true`, `func` will be called
* on the trailing edge of the timeout only if the the debounced function is
* invoked more than once during the `wait` timeout.
*
@@ -5188,7 +5191,7 @@
* of the `wait` timeout. Subsequent calls to the throttled function will
* return the result of the last `func` call.
*
* Note: If `leading` and `trailing` options are `true` `func` will be called
* Note: If `leading` and `trailing` options are `true`, `func` will be called
* on the trailing edge of the timeout only if the the throttled function is
* invoked more than once during the `wait` timeout.
*
@@ -6056,7 +6059,7 @@
}
/**
* Checks if `value` is the language type of Object.
* Checks if `value` is the language type of `Object`.
* (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
*
* @static
@@ -6076,7 +6079,7 @@
* // => false
*/
function isObject(value) {
// check if the value is the ECMAScript language type of Object
// check if the value is the ECMAScript language type of `Object`
// http://es5.github.io/#x8
// and avoid a V8 bug
// https://code.google.com/p/v8/issues/detail?id=2291
@@ -6112,7 +6115,7 @@
*/
function isNaN(value) {
// `NaN` as a primitive is the only value that is not equal to itself
// (perform the [[Class]] check first to avoid errors with some host objects in IE)
// (perform the `[[Class]]` check first to avoid errors with some host objects in IE)
return isNumber(value) && value != +value;
}
@@ -6282,6 +6285,10 @@
* // => ['x', 'y'] (property order is not guaranteed across environments)
*/
var keys = !nativeKeys ? shimKeys : function(object) {
var length = object ? object.length : 0;
if (typeof length == 'number' && length > 0) {
return shimKeys(object);
}
return isObject(object) ? nativeKeys(object) : [];
};
@@ -6306,12 +6313,24 @@
* // => ['x', 'y', 'z'] (property order is not guaranteed across environments)
*/
function keysIn(object) {
var result = [];
if (!isObject(object)) {
return result;
return [];
}
var length = isArray(object) ? object.length : 0,
maxIndex = length - 1,
result = Array(length),
skipIndexes = length > 0;
if (skipIndexes) {
var index = -1;
while (++index < length) {
result[index] = String(index);
}
}
for (var key in object) {
result.push(key);
if (!(skipIndexes && key > -1 && key <= maxIndex && key % 1 == 0)) {
result.push(key);
}
}
return result;
}
@@ -6767,7 +6786,7 @@
}
/**
* Escapes the RegExp special characters "\", "^", "$", ".", "|", "?", "*",
* Escapes the `RegExp` special characters "\", "^", "$", ".", "|", "?", "*",
* "+", "(", ")", "[", "]", "{" and "}" in `string`.
*
* @static
@@ -7003,7 +7022,7 @@
* settings object is provided it will override `_.templateSettings` for the
* template.
*
* Note: In the development build, `_.template` utilizes sourceURLs for easier debugging.
* Note: In the development build, `_.template` utilizes `sourceURL`s for easier debugging.
* See the [HTML5 Rocks article on sourcemaps](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
* for more details.
*
@@ -7023,7 +7042,7 @@
* @param {RegExp} [options.evaluate] The "evaluate" delimiter.
* @param {Object} [options.imports] An object to import into the template as local variables.
* @param {RegExp} [options.interpolate] The "interpolate" delimiter.
* @param {string} [options.sourceURL] The sourceURL of the template's compiled source.
* @param {string} [options.sourceURL] The `sourceURL` of the template's compiled source.
* @param {string} [options.variable] The data object variable name.
* @returns {Function|string} Returns the interpolated string if a data object
* is provided, else the compiled template function.
@@ -7061,7 +7080,7 @@
* _.template(list, { 'people': ['fred', 'barney'] }, { 'imports': { 'jq': jQuery } });
* // => '<li>fred</li><li>barney</li>'
*
* // using the `sourceURL` option to specify a custom sourceURL for the template
* // using the `sourceURL` option to specify a custom `sourceURL` for the template
* var compiled = _.template('hello <%= name %>', null, { 'sourceURL': '/basic/greeting.jst' });
* compiled(data);
* // => find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector
@@ -7167,7 +7186,7 @@
source +
'return __p\n}';
// Use a sourceURL for easier debugging.
// Use a `sourceURL` for easier debugging.
// http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl
var sourceURL = '\n/*\n//# sourceURL=' + (options.sourceURL || '/lodash/template/source[' + (templateCounter++) + ']') + '\n*/';
@@ -7267,7 +7286,7 @@
* @static
* @memberOf _
* @category Strings
* @param {string} [string=''] The string to trim.
* @param {string} [string=''] The string to truncate.
* @param {Object|number} [options] The options object or maximum string length.
* @param {number} [options.length=30] The maximum string length.
* @param {string} [options.omission='...'] The string used to indicate text is omitted.
@@ -7637,7 +7656,7 @@
/**
* Converts `value` to an integer of the specified radix. If `radix` is
* `undefined` or `0` a `radix` of `10` is used unless `value` is a hexadecimal,
* `undefined` or `0`, a `radix` of `10` is used unless `value` is a hexadecimal,
* in which case a `radix` of `16` is used.
*
* Note: This method avoids differences in native ES3 and ES5 `parseInt`