Created
July 16, 2019 06:25
-
-
Save ClausClaus/52d2ea8183eba2dbe4ae9a1853463e81 to your computer and use it in GitHub Desktop.
assign 对象合并
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
export const assign = Object.assign || function (target, ...args) { | |
target = Object(target); | |
for (let i = 0; i < args.length; i++) { | |
const source = args[i]; | |
if (source !== null) { | |
for (const key in source) { | |
if (hasOwn(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