Skip to content

Instantly share code, notes, and snippets.

@misaka42
Created September 10, 2018 11:21
Show Gist options
  • Save misaka42/eec2a7875058a7766ad63c68a713a305 to your computer and use it in GitHub Desktop.
Save misaka42/eec2a7875058a7766ad63c68a713a305 to your computer and use it in GitHub Desktop.
simple-extend for tiny library ( extend default config / option )
function extend() {
const target = arguments[0] || {};
for (let i = 1; i < arguments.length; i++) {
const source = arguments[i];
for (const key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment