Last change
on this file since 6fe77af was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
747 bytes
|
Line | |
---|
1 | var hashClear = require('./_hashClear'),
|
---|
2 | hashDelete = require('./_hashDelete'),
|
---|
3 | hashGet = require('./_hashGet'),
|
---|
4 | hashHas = require('./_hashHas'),
|
---|
5 | hashSet = require('./_hashSet');
|
---|
6 |
|
---|
7 | /**
|
---|
8 | * Creates a hash object.
|
---|
9 | *
|
---|
10 | * @private
|
---|
11 | * @constructor
|
---|
12 | * @param {Array} [entries] The key-value pairs to cache.
|
---|
13 | */
|
---|
14 | function Hash(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 `Hash`.
|
---|
26 | Hash.prototype.clear = hashClear;
|
---|
27 | Hash.prototype['delete'] = hashDelete;
|
---|
28 | Hash.prototype.get = hashGet;
|
---|
29 | Hash.prototype.has = hashHas;
|
---|
30 | Hash.prototype.set = hashSet;
|
---|
31 |
|
---|
32 | module.exports = Hash;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.