Skip to content

Instantly share code, notes, and snippets.

@subtleGradient
Created February 9, 2009 19:09
Show Gist options
  • Select an option

  • Save subtleGradient/60933 to your computer and use it in GitHub Desktop.

Select an option

Save subtleGradient/60933 to your computer and use it in GitHub Desktop.
get / set API thinking
var key = 'key';
var KEY = {some: object};
var val = {other: object};
// "normal" stuff
object.set(key, val) // -> object
object.set({key: val}) // -> object
object.get(key) // -> someValue
object.get(key, key) // -> { key:value }
object.get([key, key, key]) // -> { key:value }
// Dictionary
object.sets([KEY], val) // -> object
object.sets([KEY, KEY], val) // -> object
object.sets([KEY, KEY], [val, val]) // -> object
object.gets(KEY, KEY, KEY); // -> ?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment