12 lines
316 B
JavaScript
12 lines
316 B
JavaScript
export default function merge() {
|
|
var obj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
var defaults = arguments.length > 1 ? arguments[1] : undefined;
|
|
|
|
for (var key in defaults) {
|
|
if (typeof obj[key] === 'undefined') {
|
|
obj[key] = defaults[key];
|
|
}
|
|
}
|
|
|
|
return obj;
|
|
} |