Skip to content

Instantly share code, notes, and snippets.

@basarat
Created January 18, 2016 16:52
Show Gist options
  • Save basarat/49e7d7d4c85d3ffbb3d9 to your computer and use it in GitHub Desktop.
Save basarat/49e7d7d4c85d3ffbb3d9 to your computer and use it in GitHub Desktop.
export function extend(...args: any[]):any {
let extractFields = obj => {
for (let key in obj) {
//copy all the fields
newObj[key] = obj[key];
}
}
var extendRecursive = (x:any[]) => {
for (let obj of x) {
if (obj) {
if (obj instanceof Array) {
extendRecursive(obj)
}
else {
extractFields(obj);
}
}
}
}
let newObj = {};
extractFields({});
return newObj;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment