mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-02 08:07:50 +00:00
Move internal modules to “internal” folder.
This commit is contained in:
29
.internal/SetCache.js
Normal file
29
.internal/SetCache.js
Normal file
@@ -0,0 +1,29 @@
|
||||
import MapCache from './.internal/MapCache.js';
|
||||
import setCacheAdd from './.internal/setCacheAdd.js';
|
||||
import setCacheHas from './.internal/setCacheHas.js';
|
||||
|
||||
/**
|
||||
*
|
||||
* Creates an array cache object to store unique values.
|
||||
*
|
||||
* @private
|
||||
* @constructor
|
||||
* @param {Array} [values] The values to cache.
|
||||
*/
|
||||
class SetCache {
|
||||
constructor(values) {
|
||||
let index = -1;
|
||||
const length = values == null ? 0 : values.length;
|
||||
|
||||
this.__data__ = new MapCache;
|
||||
while (++index < length) {
|
||||
this.add(values[index]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Add methods to `SetCache`.
|
||||
SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
|
||||
SetCache.prototype.has = setCacheHas;
|
||||
|
||||
export default SetCache;
|
||||
Reference in New Issue
Block a user