Last active
December 14, 2015 06:59
-
-
Save hughfdjackson/5047249 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void function(root){ | |
| var data = new WeakMap | |
| var meta = function(o, v){ | |
| if ( arguements.length === 1 ) return data.get(o) | |
| else return data.set(o, v) | |
| } | |
| root.meta = meta | |
| }(this) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var o = { | |
| name: 'hugh' | |
| } | |
| meta(o, { type: 'user', isHuman: true, hasBeenSaved: false }) | |
| meta(o) // { type: 'user', isHuman: true, hasBeenSaved: false } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment