mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-04 00:57:48 +00:00
Bump to v4.0.0.
This commit is contained in:
@@ -1,29 +1,24 @@
|
||||
var cachePush = require('./cachePush'),
|
||||
getNative = require('./getNative');
|
||||
|
||||
/** Native method references. */
|
||||
var Set = getNative(global, 'Set');
|
||||
|
||||
/* Native method references for those with the same name as other `lodash` methods. */
|
||||
var nativeCreate = getNative(Object, 'create');
|
||||
var MapCache = require('./MapCache'),
|
||||
cachePush = require('./cachePush');
|
||||
|
||||
/**
|
||||
*
|
||||
* Creates a cache object to store unique values.
|
||||
* Creates a set cache object to store unique values.
|
||||
*
|
||||
* @private
|
||||
* @param {Array} [values] The values to cache.
|
||||
*/
|
||||
function SetCache(values) {
|
||||
var length = values ? values.length : 0;
|
||||
var index = -1,
|
||||
length = values ? values.length : 0;
|
||||
|
||||
this.data = { 'hash': nativeCreate(null), 'set': new Set };
|
||||
while (length--) {
|
||||
this.push(values[length]);
|
||||
this.__data__ = new MapCache;
|
||||
while (++index < length) {
|
||||
this.push(values[index]);
|
||||
}
|
||||
}
|
||||
|
||||
// Add functions to the `Set` cache.
|
||||
// Add functions to the `SetCache`.
|
||||
SetCache.prototype.push = cachePush;
|
||||
|
||||
module.exports = SetCache;
|
||||
|
||||
Reference in New Issue
Block a user