Skip to content

Instantly share code, notes, and snippets.

@ClausClaus
Created July 16, 2019 06:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ClausClaus/52d2ea8183eba2dbe4ae9a1853463e81 to your computer and use it in GitHub Desktop.
Save ClausClaus/52d2ea8183eba2dbe4ae9a1853463e81 to your computer and use it in GitHub Desktop.
assign 对象合并
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