Skip to content

Commit f295cfe

Browse files
committed
remove duplicate key copies
1 parent 81858b7 commit f295cfe

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

lib/dict.js

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,16 @@
11
var Dict = module.exports = function Dict() {
22
Object.defineProperty(this, "_keys", {
33
enumerable: false,
4-
value: {},
4+
value: [],
55
})
66
}
77

88
Dict.prototype.binaryKeys = function binaryKeys() {
9-
return Object.keys(this._keys).map(function(e) {
10-
return Buffer(e, "hex")
11-
})
12-
}
13-
14-
Dict.prototype.binaryGet = function binaryGet(key) {
15-
key = key.toString("hex")
16-
17-
return this._keys[key] && this[this._keys[key]]
9+
return this._keys.slice()
1810
}
1911

2012
Dict.prototype.binarySet = function binarySet(key, value) {
21-
this._keys[key.toString("hex")] = key.toString()
13+
this._keys.push(key)
2214

2315
this[key] = value
2416
}

0 commit comments

Comments
 (0)