Created
January 18, 2016 16:52
-
-
Save basarat/49e7d7d4c85d3ffbb3d9 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 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