Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
31 lines (25 sloc) 557 Bytes

dict.js

by Dave herman

Simple dictionaries with lightweight syntax, using ES6 features (proxies, weak maps).

Examples:

js> var d = new Dict({ foo: 17, bar: "hello world", baz: 42 });
js> Dict.size(d)
3
js> d.foo
17
js> "bar" in d
true
js> "hasOwnProperty" in d
false
js> d.hasOwnProperty = "yo dawg"
"yo dawg"
js> Dict.size(d)
4
js> delete d.baz
true
js> "baz" in d
false
js> d instanceof Dict
true
js> d instanceof Object
false