Created
April 11, 2014 14:48
-
-
Save jonathanmarvens/10474900 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
function extend() { | |
var consumer = arguments[0]; | |
var providers = ([]).slice.call(arguments, 1); | |
for (var a = 0; a < providers.length; a++) { | |
var provider = providers[a]; | |
var except = (provider['except'] || []); | |
except.push('except'); | |
for (var property in provider) { | |
if ((except.indexOf(property) < 0) && provider.hasOwnProperty(property)) { | |
consumer[property] = provider[property]; | |
} | |
} | |
} | |
return consumer; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment