main
Last change
on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
630 bytes
|
Rev | Line | |
---|
[d565449] | 1 | import MapCache from './_MapCache.js';
|
---|
| 2 | import setCacheAdd from './_setCacheAdd.js';
|
---|
| 3 | import setCacheHas from './_setCacheHas.js';
|
---|
| 4 |
|
---|
| 5 | /**
|
---|
| 6 | *
|
---|
| 7 | * Creates an array cache object to store unique values.
|
---|
| 8 | *
|
---|
| 9 | * @private
|
---|
| 10 | * @constructor
|
---|
| 11 | * @param {Array} [values] The values to cache.
|
---|
| 12 | */
|
---|
| 13 | function SetCache(values) {
|
---|
| 14 | var index = -1,
|
---|
| 15 | length = values == null ? 0 : values.length;
|
---|
| 16 |
|
---|
| 17 | this.__data__ = new MapCache;
|
---|
| 18 | while (++index < length) {
|
---|
| 19 | this.add(values[index]);
|
---|
| 20 | }
|
---|
| 21 | }
|
---|
| 22 |
|
---|
| 23 | // Add methods to `SetCache`.
|
---|
| 24 | SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
|
---|
| 25 | SetCache.prototype.has = setCacheHas;
|
---|
| 26 |
|
---|
| 27 | export default SetCache;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.