Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Simple left-to-right mixin
var mixin = function () {
var args = Array.prototype.slice.call(arguments);
var target = args.shift();
var source = args.shift();
// We don't need no hasOwnProperty checks!
for (var prop in source) {
target[prop] = source[prop];
}
if (args.length) {
args.unshift(target);
return mixin.apply(null, args);
}
else {
return target;
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.