Last change
on this file since 6a3a178 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
869 bytes
|
Rev | Line | |
---|
[6a3a178] | 1 | var listCacheClear = require('./_listCacheClear'),
|
---|
| 2 | listCacheDelete = require('./_listCacheDelete'),
|
---|
| 3 | listCacheGet = require('./_listCacheGet'),
|
---|
| 4 | listCacheHas = require('./_listCacheHas'),
|
---|
| 5 | listCacheSet = require('./_listCacheSet');
|
---|
| 6 |
|
---|
| 7 | /**
|
---|
| 8 | * Creates an list cache object.
|
---|
| 9 | *
|
---|
| 10 | * @private
|
---|
| 11 | * @constructor
|
---|
| 12 | * @param {Array} [entries] The key-value pairs to cache.
|
---|
| 13 | */
|
---|
| 14 | function ListCache(entries) {
|
---|
| 15 | var index = -1,
|
---|
| 16 | length = entries == null ? 0 : entries.length;
|
---|
| 17 |
|
---|
| 18 | this.clear();
|
---|
| 19 | while (++index < length) {
|
---|
| 20 | var entry = entries[index];
|
---|
| 21 | this.set(entry[0], entry[1]);
|
---|
| 22 | }
|
---|
| 23 | }
|
---|
| 24 |
|
---|
| 25 | // Add methods to `ListCache`.
|
---|
| 26 | ListCache.prototype.clear = listCacheClear;
|
---|
| 27 | ListCache.prototype['delete'] = listCacheDelete;
|
---|
| 28 | ListCache.prototype.get = listCacheGet;
|
---|
| 29 | ListCache.prototype.has = listCacheHas;
|
---|
| 30 | ListCache.prototype.set = listCacheSet;
|
---|
| 31 |
|
---|
| 32 | module.exports = ListCache;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.