Created
September 10, 2018 11:21
-
-
Save misaka42/eec2a7875058a7766ad63c68a713a305 to your computer and use it in GitHub Desktop.
simple-extend for tiny library ( extend default config / option )
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
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