Last active
April 16, 2018 08:30
-
-
Save ishiduca/59e7ed73d77eea9d399ea7e9e6554db9 to your computer and use it in GitHub Desktop.
This file contains 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
var xtend = require('xtend') | |
module.exports = combine | |
function combine (a, b) { | |
return function () { | |
return xtend(a.apply(null, arguments), b.apply(null, arguments)) | |
} | |
} |
This file contains 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
var combine = require('./combine') | |
var hasOwnProperty = Object.prototype.hasOwnProperty | |
module.exports = compose | |
function compose () { | |
var o = {} | |
for (var i = 0; i < arguments.length; i++) { | |
var a = arguments[i] | |
for (var p in a) { | |
if (hasOwnProperty(a, p)) { | |
o[p] = o[p] == null ? a[p] : combine(o[p], a[p]) | |
} | |
} | |
} | |
return o | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment