Skip to content

Instantly share code, notes, and snippets.

@ondrek
Forked from adros/pattern.js
Created April 16, 2015 11:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ondrek/7ef9b00f49d644274926 to your computer and use it in GitHub Desktop.
Save ondrek/7ef9b00f49d644274926 to your computer and use it in GitHub Desktop.
window.$config = function(){
var Config = function(){};
var selves = [];
Config.prototype = {
get $set(){ var self={}; selves.push(self); return self; },
get $get(){ return mixin(selves); }
};
return new Config();
function mixin(array){
return array.reduce(function(obj, item){
for(var p in item){obj[p]=item[p];}
return obj;
},{})
}
};
// dev
var config = $config();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment