Skip to content

Instantly share code, notes, and snippets.

@MoOx
Created October 4, 2013 19:53
Show Gist options
  • Save MoOx/6831777 to your computer and use it in GitHub Desktop.
Save MoOx/6831777 to your computer and use it in GitHub Desktop.
{
"theme": {
"default": {}
"foo": {
"parent": "default",
},
"local": {
"parent": "foo",
}
}
@bloodyowl
Copy link

var i, theme, cache, k, hasOwn = {}.hasOwnProperty
for(i in themes){
  if(themes[i].parent) {
    cache = themes[i]
    themes[i] = Object.create(themes[parent])
    for(k in cache) {
      if(!hasOwn.call(cache, k) continue
      themes[i][k] = cache[k]
    }
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment