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

172
dist/lodash.compat.js vendored
View File

@@ -4,7 +4,7 @@
* Build: `lodash -o ./dist/lodash.compat.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,13 +100,13 @@
'parseInt', 'setTimeout', 'TypeError', 'window', 'WinRTError'
];
/** Used to fix the JScript [[DontEnum]] bug */
/** Used to fix the JScript `[[DontEnum]]` bug */
var shadowedProps = [
'constructor', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable',
'toLocaleString', 'toString', 'valueOf'
];
/** Used to make template sourceURLs easier to identify */
/** Used to make template `sourceURL`s easier to identify */
var templateCounter = 0;
/** `Object#toString` result shortcuts */
@@ -195,7 +195,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
@@ -316,6 +316,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) {
@@ -335,6 +336,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) {
@@ -348,7 +350,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
@@ -361,7 +363,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
@@ -425,7 +427,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.
@@ -436,7 +438,7 @@
}
/**
* Used by `template` to escape characters for inclusion in compiled
* Used by `_.template` to escape characters for inclusion in compiled
* string literals.
*
* @private
@@ -461,7 +463,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
@@ -482,7 +484,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
@@ -503,7 +505,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
@@ -564,7 +566,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.
@@ -577,7 +579,7 @@
/*--------------------------------------------------------------------------*/
/**
* Create a new `lodash` function using the given context object.
* Create a new `lodash` function using the given `context` object.
*
* @static
* @memberOf _
@@ -614,17 +616,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 */
@@ -647,7 +649,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 {
@@ -674,7 +676,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;
@@ -785,7 +787,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) {
@@ -814,7 +816,7 @@
for (key in arguments) { }
/**
* Detect if an `arguments` object's [[Class]] is resolvable (all but Firefox < 4, IE < 9).
* Detect if an `arguments` object's `[[Class]]` is resolvable (all but Firefox < 4, IE < 9).
*
* @memberOf _.support
* @type boolean
@@ -843,8 +845,8 @@
*
* Firefox < 3.6, Opera > 9.50 - Opera < 11.60, and Safari < 5.1
* (if the prototype or a property on the prototype has been set)
* incorrectly sets a function's `prototype` property [[Enumerable]]
* value to `true`.
* incorrectly sets the `[[Enumerable]]` value of a function's `prototype`
* property to `true`.
*
* @memberOf _.support
* @type boolean
@@ -881,7 +883,7 @@
* Detect if properties shadowing those on `Object.prototype` are non-enumerable.
*
* In IE < 9 an objects own properties, shadowing non-enumerable ones, are
* made non-enumerable as well (a.k.a the JScript [[DontEnum]] bug).
* made non-enumerable as well (a.k.a the JScript `[[DontEnum]]` bug).
*
* @memberOf _.support
* @type boolean
@@ -934,7 +936,7 @@
}
/**
* Detect if a DOM node's [[Class]] is resolvable (all but IE < 9)
* Detect if a DOM node's `[[Class]]` is resolvable (all but IE < 9)
* and that the JS engine errors when attempting to coerce an object to
* a string without a `toString` function.
*
@@ -1013,7 +1015,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.
@@ -1074,7 +1076,7 @@
return result;
}
}
// inspect [[Class]]
// inspect `[[Class]]`
var isObj = isObject(value);
if (isObj) {
var className = toString.call(value);
@@ -1228,7 +1230,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.
@@ -1392,7 +1394,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`.
*
@@ -1578,7 +1580,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,
@@ -2163,7 +2165,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.
@@ -2215,11 +2217,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) || (support.unindexedChars && isString(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);
}
}
@@ -2272,8 +2280,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));
}
/**
@@ -2710,46 +2718,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);
}
}
@@ -3427,9 +3432,7 @@
* // => 'pebbles is 1'
*/
function chain(value) {
value = new lodashWrapper(value);
value.__chain__ = true;
return value;
return new lodashWrapper(value, true);
}
/**
@@ -4906,7 +4909,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
*
@@ -4992,7 +4995,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.
*
@@ -5368,7 +5371,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.
*
@@ -5989,7 +5992,7 @@
return value && typeof value == 'object' && typeof value.length == 'number' &&
toString.call(value) == argsClass || false;
}
// fallback for environments that can't detect `arguments` objects by [[Class]]
// fallback for environments that can't detect `arguments` objects by `[[Class]]`
if (!support.argsClass) {
isArguments = function(value) {
return value && typeof value == 'object' && typeof value.length == 'number' &&
@@ -6250,7 +6253,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
@@ -6270,7 +6273,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
@@ -6306,7 +6309,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;
}
@@ -6478,8 +6481,8 @@
* // => ['x', 'y'] (property order is not guaranteed across environments)
*/
var keys = !nativeKeys ? shimKeys : function(object) {
if ((support.enumPrototypes && typeof object == 'function') ||
(support.nonEnumArgs && object && object.length && isArguments(object))) {
var length = object ? object.length : 0;
if (typeof length == 'number' && length > 0) {
return shimKeys(object);
}
return isObject(object) ? nativeKeys(object) : [];
@@ -6506,19 +6509,30 @@
* // => ['x', 'y', 'z'] (property order is not guaranteed across environments)
*/
function keysIn(object) {
var result = [];
if (!isObject(object)) {
return result;
return [];
}
if (support.nonEnumArgs && object.length && isArguments(object)) {
object = slice(object);
}
var skipProto = support.enumPrototypes && typeof object == 'function',
skipErrorProps = support.enumErrorProps && (object === errorProto || object instanceof Error);
var length = object.length;
length = (typeof length == 'number' && length > 0 &&
(isArray(object) || (support.unindexedChars && isString(object)) ||
(support.nonEnumArgs && isArguments(object))) && length) >>> 0;
var maxIndex = length - 1,
result = Array(length),
skipIndexes = length > 0,
skipErrorProps = support.enumErrorProps && (object === errorProto || object instanceof Error),
skipProto = support.enumPrototypes && typeof object == 'function';
if (skipIndexes) {
var index = -1;
while (++index < length) {
result[index] = String(index);
}
}
for (var key in object) {
if (!(skipProto && key == 'prototype') &&
!(skipErrorProps && (key == 'message' || key == 'name'))) {
!(skipErrorProps && (key == 'message' || key == 'name')) &&
!(skipIndexes && key > -1 && key <= maxIndex && key % 1 == 0)) {
result.push(key);
}
}
@@ -6527,9 +6541,9 @@
// attribute of an existing property and the `constructor` property of a
// prototype defaults to non-enumerable.
if (support.nonEnumShadows && object !== objectProto) {
var ctor = object.constructor,
index = -1,
length = shadowedProps.length;
var ctor = object.constructor;
index = -1;
length = shadowedProps.length;
if (object === (ctor && ctor.prototype)) {
var className = object === stringProto ? stringClass : object === errorProto ? errorClass : toString.call(object),
@@ -6996,7 +7010,7 @@
}
/**
* Escapes the RegExp special characters "\", "^", "$", ".", "|", "?", "*",
* Escapes the `RegExp` special characters "\", "^", "$", ".", "|", "?", "*",
* "+", "(", ")", "[", "]", "{" and "}" in `string`.
*
* @static
@@ -7232,7 +7246,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.
*
@@ -7252,7 +7266,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.
@@ -7290,7 +7304,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
@@ -7396,7 +7410,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*/';
@@ -7496,7 +7510,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.
@@ -7866,7 +7880,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`