mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-07 01:57:50 +00:00
Fix builds.
This commit is contained in:
71
dist/lodash.compat.js
vendored
71
dist/lodash.compat.js
vendored
@@ -1232,6 +1232,43 @@
|
|||||||
return bound;
|
return bound;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The base implementation of `_.difference` that accepts a single array
|
||||||
|
* of values to exclude.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @param {Array} array The array to process.
|
||||||
|
* @param {Array} [values] The array of values to exclude.
|
||||||
|
* @returns {Array} Returns a new array of filtered values.
|
||||||
|
*/
|
||||||
|
function baseDifference(array, values) {
|
||||||
|
var index = -1,
|
||||||
|
indexOf = getIndexOf(),
|
||||||
|
length = array ? array.length : 0,
|
||||||
|
isLarge = length >= largeArraySize && indexOf === baseIndexOf,
|
||||||
|
result = [];
|
||||||
|
|
||||||
|
if (isLarge) {
|
||||||
|
var cache = createCache(values);
|
||||||
|
if (cache) {
|
||||||
|
indexOf = cacheIndexOf;
|
||||||
|
values = cache;
|
||||||
|
} else {
|
||||||
|
isLarge = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
while (++index < length) {
|
||||||
|
var value = array[index];
|
||||||
|
if (indexOf(values, value) < 0) {
|
||||||
|
result.push(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (isLarge) {
|
||||||
|
releaseObject(values);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The base implementation of `_.flatten` without support for callback
|
* The base implementation of `_.flatten` without support for callback
|
||||||
* shorthands or `thisArg` binding.
|
* shorthands or `thisArg` binding.
|
||||||
@@ -2977,7 +3014,7 @@
|
|||||||
forIn(object, function(value, key) {
|
forIn(object, function(value, key) {
|
||||||
props.push(key);
|
props.push(key);
|
||||||
});
|
});
|
||||||
props = difference(props, baseFlatten(arguments, true, false, 1));
|
props = baseDifference(props, baseFlatten(arguments, true, false, 1));
|
||||||
|
|
||||||
var index = -1,
|
var index = -1,
|
||||||
length = props.length;
|
length = props.length;
|
||||||
@@ -4356,7 +4393,7 @@
|
|||||||
* @memberOf _
|
* @memberOf _
|
||||||
* @category Arrays
|
* @category Arrays
|
||||||
* @param {Array} array The array to process.
|
* @param {Array} array The array to process.
|
||||||
* @param {...Array} [array] The arrays of values to exclude.
|
* @param {...Array} [values] The arrays of values to exclude.
|
||||||
* @returns {Array} Returns a new array of filtered values.
|
* @returns {Array} Returns a new array of filtered values.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
@@ -4364,33 +4401,7 @@
|
|||||||
* // => [1, 3, 4]
|
* // => [1, 3, 4]
|
||||||
*/
|
*/
|
||||||
function difference(array) {
|
function difference(array) {
|
||||||
var index = -1,
|
return baseDifference(array, baseFlatten(arguments, true, true, 1));
|
||||||
indexOf = getIndexOf(),
|
|
||||||
length = array ? array.length : 0,
|
|
||||||
seen = baseFlatten(arguments, true, true, 1),
|
|
||||||
result = [];
|
|
||||||
|
|
||||||
var isLarge = length >= largeArraySize && indexOf === baseIndexOf;
|
|
||||||
|
|
||||||
if (isLarge) {
|
|
||||||
var cache = createCache(seen);
|
|
||||||
if (cache) {
|
|
||||||
indexOf = cacheIndexOf;
|
|
||||||
seen = cache;
|
|
||||||
} else {
|
|
||||||
isLarge = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
while (++index < length) {
|
|
||||||
var value = array[index];
|
|
||||||
if (indexOf(seen, value) < 0) {
|
|
||||||
result.push(value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (isLarge) {
|
|
||||||
releaseObject(seen);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -5254,7 +5265,7 @@
|
|||||||
* // => [2, 3, 4]
|
* // => [2, 3, 4]
|
||||||
*/
|
*/
|
||||||
function without(array) {
|
function without(array) {
|
||||||
return difference(array, slice(arguments, 1));
|
return baseDifference(array, slice(arguments, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
86
dist/lodash.underscore.js
vendored
86
dist/lodash.underscore.js
vendored
@@ -104,60 +104,6 @@
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* An implementation of `_.contains` for cache objects that mimics the return
|
|
||||||
* signature of `_.indexOf` by returning `0` if the value is found, else `-1`.
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
* @param {Object} cache The cache object to inspect.
|
|
||||||
* @param {*} value The value to search for.
|
|
||||||
* @returns {number} Returns `0` if `value` is found, else `-1`.
|
|
||||||
*/
|
|
||||||
function cacheIndexOf(cache, value) {
|
|
||||||
var type = typeof value;
|
|
||||||
cache = cache.cache;
|
|
||||||
|
|
||||||
if (type == 'boolean' || value == null) {
|
|
||||||
return cache[value] ? 0 : -1;
|
|
||||||
}
|
|
||||||
if (type != 'number' && type != 'string') {
|
|
||||||
type = 'object';
|
|
||||||
}
|
|
||||||
var key = type == 'number' ? value : keyPrefix + value;
|
|
||||||
cache = (cache = cache[type]) && cache[key];
|
|
||||||
|
|
||||||
return type == 'object'
|
|
||||||
? (cache && baseIndexOf(cache, value) > -1 ? 0 : -1)
|
|
||||||
: (cache ? 0 : -1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds a given value to the corresponding cache object.
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
* @param {*} value The value to add to the cache.
|
|
||||||
*/
|
|
||||||
function cachePush(value) {
|
|
||||||
var cache = this.cache,
|
|
||||||
type = typeof value;
|
|
||||||
|
|
||||||
if (type == 'boolean' || value == null) {
|
|
||||||
cache[value] = true;
|
|
||||||
} else {
|
|
||||||
if (type != 'number' && type != 'string') {
|
|
||||||
type = 'object';
|
|
||||||
}
|
|
||||||
var key = type == 'number' ? value : keyPrefix + value,
|
|
||||||
typeCache = cache[type] || (cache[type] = {});
|
|
||||||
|
|
||||||
if (type == 'object') {
|
|
||||||
(typeCache[key] || (typeCache[key] = [])).push(value);
|
|
||||||
} else {
|
|
||||||
typeCache[key] = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used by `sortBy` to compare transformed `collection` elements, stable sorting
|
* Used by `sortBy` to compare transformed `collection` elements, stable sorting
|
||||||
* them in ascending order.
|
* them in ascending order.
|
||||||
@@ -188,38 +134,6 @@
|
|||||||
return a.index - b.index;
|
return a.index - b.index;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a cache object to optimize linear searches of large arrays.
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
* @param {Array} [array=[]] The array to search.
|
|
||||||
* @returns {null|Object} Returns the cache object or `null` if caching should not be used.
|
|
||||||
*/
|
|
||||||
function createCache(array) {
|
|
||||||
var index = -1,
|
|
||||||
length = array.length,
|
|
||||||
first = array[0],
|
|
||||||
mid = array[(length / 2) | 0],
|
|
||||||
last = array[length - 1];
|
|
||||||
|
|
||||||
if (first && typeof first == 'object' &&
|
|
||||||
mid && typeof mid == 'object' && last && typeof last == 'object') {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
var cache = getObject();
|
|
||||||
cache['false'] = cache['null'] = cache['true'] = cache['undefined'] = false;
|
|
||||||
|
|
||||||
var result = getObject();
|
|
||||||
result.array = array;
|
|
||||||
result.cache = cache;
|
|
||||||
result.push = cachePush;
|
|
||||||
|
|
||||||
while (++index < length) {
|
|
||||||
result.push(array[index]);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used by `template` to escape characters for inclusion in compiled
|
* Used by `template` to escape characters for inclusion in compiled
|
||||||
* string literals.
|
* string literals.
|
||||||
|
|||||||
Reference in New Issue
Block a user