mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-06 01:47:48 +00:00
Rebuild files and docs.
Former-commit-id: 697fc5842bb6099f48e3731940c9e329452850d2
This commit is contained in:
71
dist/lodash.underscore.js
vendored
71
dist/lodash.underscore.js
vendored
@@ -73,6 +73,7 @@
|
||||
arrayClass = '[object Array]',
|
||||
boolClass = '[object Boolean]',
|
||||
dateClass = '[object Date]',
|
||||
errorClass = '[object Error]',
|
||||
funcClass = '[object Function]',
|
||||
numberClass = '[object Number]',
|
||||
objectClass = '[object Object]',
|
||||
@@ -103,15 +104,17 @@
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
/** Used for `Array` and `Object` method references */
|
||||
var arrayRef = Array(),
|
||||
objectRef = Object();
|
||||
var arrayProto = Array.prototype,
|
||||
errorProto = Error.prototype,
|
||||
objectProto = Object.prototype,
|
||||
stringProto = String.prototype;
|
||||
|
||||
/** Used to restore the original `_` reference in `noConflict` */
|
||||
var oldDash = window._;
|
||||
|
||||
/** Used to detect if a method is native */
|
||||
var reNative = RegExp('^' +
|
||||
String(objectRef.valueOf)
|
||||
String(objectProto.valueOf)
|
||||
.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
|
||||
.replace(/valueOf|for [^\]]+/g, '.+?') + '$'
|
||||
);
|
||||
@@ -119,12 +122,12 @@
|
||||
/** Native method shortcuts */
|
||||
var ceil = Math.ceil,
|
||||
clearTimeout = window.clearTimeout,
|
||||
concat = arrayRef.concat,
|
||||
concat = arrayProto.concat,
|
||||
floor = Math.floor,
|
||||
hasOwnProperty = objectRef.hasOwnProperty,
|
||||
push = arrayRef.push,
|
||||
hasOwnProperty = objectProto.hasOwnProperty,
|
||||
push = arrayProto.push,
|
||||
setTimeout = window.setTimeout,
|
||||
toString = objectRef.toString;
|
||||
toString = objectProto.toString;
|
||||
|
||||
/* Native method shortcuts for methods with the same name as other `lodash` methods */
|
||||
var nativeBind = reNative.test(nativeBind = toString.bind) && nativeBind,
|
||||
@@ -135,7 +138,7 @@
|
||||
nativeMax = Math.max,
|
||||
nativeMin = Math.min,
|
||||
nativeRandom = Math.random,
|
||||
nativeSlice = arrayRef.slice;
|
||||
nativeSlice = arrayProto.slice;
|
||||
|
||||
/** Detect various environments */
|
||||
var isIeOpera = reNative.test(window.attachEvent),
|
||||
@@ -241,7 +244,7 @@
|
||||
* @memberOf _.support
|
||||
* @type Boolean
|
||||
*/
|
||||
support.spliceObjects = (arrayRef.splice.call(object, 0, 1), !object[0]);
|
||||
support.spliceObjects = (arrayProto.splice.call(object, 0, 1), !object[0]);
|
||||
}(1));
|
||||
|
||||
/**
|
||||
@@ -508,7 +511,6 @@
|
||||
var index, iterable = object, result = [];
|
||||
if (!iterable) return result;
|
||||
if (!(objectTypes[typeof object])) return result;
|
||||
|
||||
for (index in iterable) {
|
||||
if (hasOwnProperty.call(iterable, index)) {
|
||||
result.push(index);
|
||||
@@ -721,7 +723,6 @@
|
||||
var index, iterable = collection, result = iterable;
|
||||
if (!iterable) return result;
|
||||
if (!objectTypes[typeof iterable]) return result;
|
||||
|
||||
for (index in iterable) {
|
||||
if (callback(iterable[index], index, collection) === indicatorObject) return result;
|
||||
}
|
||||
@@ -753,7 +754,6 @@
|
||||
var index, iterable = collection, result = iterable;
|
||||
if (!iterable) return result;
|
||||
if (!objectTypes[typeof iterable]) return result;
|
||||
|
||||
for (index in iterable) {
|
||||
if (hasOwnProperty.call(iterable, index)) {
|
||||
if (callback(iterable[index], index, collection) === indicatorObject) return result;
|
||||
@@ -1137,7 +1137,7 @@
|
||||
// http://es5.github.com/#x8
|
||||
// and avoid a V8 bug
|
||||
// http://code.google.com/p/v8/issues/detail?id=2291
|
||||
return value ? objectTypes[typeof value] : false;
|
||||
return !!(value && objectTypes[typeof value]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1222,7 +1222,7 @@
|
||||
* // => true
|
||||
*/
|
||||
function isRegExp(value) {
|
||||
return value ? (objectTypes[typeof value] && toString.call(value) == regexpClass) : false;
|
||||
return !!(value && objectTypes[typeof value]) && toString.call(value) == regexpClass;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1286,7 +1286,7 @@
|
||||
* // => { 'name': 'moe' }
|
||||
*/
|
||||
function omit(object) {
|
||||
var props = concat.apply(arrayRef, nativeSlice.call(arguments, 1)),
|
||||
var props = concat.apply(arrayProto, nativeSlice.call(arguments, 1)),
|
||||
result = {};
|
||||
|
||||
forIn(object, function(value, key) {
|
||||
@@ -1351,7 +1351,7 @@
|
||||
*/
|
||||
function pick(object) {
|
||||
var index = -1,
|
||||
props = concat.apply(arrayRef, nativeSlice.call(arguments, 1)),
|
||||
props = concat.apply(arrayProto, nativeSlice.call(arguments, 1)),
|
||||
length = props.length,
|
||||
result = {};
|
||||
|
||||
@@ -2451,7 +2451,7 @@
|
||||
function difference(array) {
|
||||
var index = -1,
|
||||
length = array.length,
|
||||
flattened = concat.apply(arrayRef, nativeSlice.call(arguments, 1)),
|
||||
flattened = concat.apply(arrayProto, nativeSlice.call(arguments, 1)),
|
||||
result = [];
|
||||
|
||||
while (++index < length) {
|
||||
@@ -3069,9 +3069,9 @@
|
||||
*/
|
||||
function union(array) {
|
||||
if (!isArray(array)) {
|
||||
arguments[0] = array ? nativeSlice.call(array) : arrayRef;
|
||||
arguments[0] = array ? nativeSlice.call(array) : arrayProto;
|
||||
}
|
||||
return uniq(concat.apply(arrayRef, arguments));
|
||||
return uniq(concat.apply(arrayProto, arguments));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -3149,6 +3149,31 @@
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* The inverse of `_.zip`, this method splits groups of elements into arrays
|
||||
* composed of elements from each group at their corresponding indexes.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Arrays
|
||||
* @param {Array} array The array to process.
|
||||
* @returns {Array} Returns a new array of the composed arrays.
|
||||
* @example
|
||||
*
|
||||
* _.unzip([['moe', 30, true], ['larry', 40, false]]);
|
||||
* // => [['moe', 'larry'], [30, 40], [true, false]];
|
||||
*/
|
||||
function unzip(array) {
|
||||
var index = -1,
|
||||
length = array ? max(pluck(array, 'length')) : 0,
|
||||
result = Array(length < 0 ? 0 : length);
|
||||
|
||||
while (++index < length) {
|
||||
result[index] = pluck(array, index);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an array with all occurrences of the passed values removed using
|
||||
* strict equality for comparisons, i.e. `===`.
|
||||
@@ -3187,7 +3212,7 @@
|
||||
function zip(array) {
|
||||
var index = -1,
|
||||
length = array ? max(pluck(arguments, 'length')) : 0,
|
||||
result = Array(length);
|
||||
result = Array(length < 0 ? 0 : length);
|
||||
|
||||
while (++index < length) {
|
||||
result[index] = pluck(arguments, index);
|
||||
@@ -3318,7 +3343,7 @@
|
||||
* // => alerts 'clicked docs', when the button is clicked
|
||||
*/
|
||||
function bindAll(object) {
|
||||
var funcs = arguments.length > 1 ? concat.apply(arrayRef, nativeSlice.call(arguments, 1)) : functions(object),
|
||||
var funcs = arguments.length > 1 ? concat.apply(arrayProto, nativeSlice.call(arguments, 1)) : functions(object),
|
||||
index = -1,
|
||||
length = funcs.length;
|
||||
|
||||
@@ -4343,7 +4368,7 @@
|
||||
|
||||
// add `Array` mutator functions to the wrapper
|
||||
forEach(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
|
||||
var func = arrayRef[methodName];
|
||||
var func = arrayProto[methodName];
|
||||
lodash.prototype[methodName] = function() {
|
||||
var value = this.__wrapped__;
|
||||
func.apply(value, arguments);
|
||||
@@ -4359,7 +4384,7 @@
|
||||
|
||||
// add `Array` accessor functions to the wrapper
|
||||
forEach(['concat', 'join', 'slice'], function(methodName) {
|
||||
var func = arrayRef[methodName];
|
||||
var func = arrayProto[methodName];
|
||||
lodash.prototype[methodName] = function() {
|
||||
var value = this.__wrapped__,
|
||||
result = func.apply(value, arguments);
|
||||
|
||||
Reference in New Issue
Block a user