-
-
Save ondrek/7ef9b00f49d644274926 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
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