use Object.create for Dict instead of a key prefix
This commit is contained in:
parent
fed34c7d07
commit
5376c8b4e1
8
pdf.js
8
pdf.js
@ -126,17 +126,15 @@ var Cmd = (function() {
|
|||||||
|
|
||||||
var Dict = (function() {
|
var Dict = (function() {
|
||||||
function constructor() {
|
function constructor() {
|
||||||
|
this.map = Object.create(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor.prototype = {
|
constructor.prototype = {
|
||||||
get: function(key) {
|
get: function(key) {
|
||||||
return this["$" + key];
|
return this.map[key];
|
||||||
},
|
},
|
||||||
set: function(key, value) {
|
set: function(key, value) {
|
||||||
this["$" + key] = value;
|
this.map[key] = value;
|
||||||
},
|
|
||||||
contains: function(key) {
|
|
||||||
return ("$" + key) in this;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user