Skip to content

Instantly share code, notes, and snippets.

@hughfdjackson
Last active December 14, 2015 06:59
Show Gist options
  • Select an option

  • Save hughfdjackson/5047249 to your computer and use it in GitHub Desktop.

Select an option

Save hughfdjackson/5047249 to your computer and use it in GitHub Desktop.
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)
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