Skip to content

Instantly share code, notes, and snippets.

@Zirak
Last active September 7, 2016 16:30
Show Gist options
  • Select an option

  • Save Zirak/8671560 to your computer and use it in GitHub Desktop.

Select an option

Save Zirak/8671560 to your computer and use it in GitHub Desktop.
var Dictionary = {
new : function () {
var ret = Object.create(this);
ret.data = {};
return ret;
},
set : function (key, value) {
this.data[key] = value;
return this;
},
get : function (key, def) {
if (key in this.data) {
return this.data[key];
}
return def;
},
remove : function (key) {
delete this.data[key];
return this;
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment