mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-04 17:07:49 +00:00
Fix builds.
This commit is contained in:
86
dist/lodash.underscore.js
vendored
86
dist/lodash.underscore.js
vendored
@@ -104,60 +104,6 @@
|
||||
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
|
||||
* them in ascending order.
|
||||
@@ -188,38 +134,6 @@
|
||||
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
|
||||
* string literals.
|
||||
|
||||
Reference in New Issue
Block a user