Created
March 24, 2019 15:03
-
-
Save mdmoin7/1bd98361c186a339fc687ea1e7ff55d6 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
const createObject=(custom_schema,missingKeys,data)=>{ | |
const newObj=Object.create({}); | |
// add available keys | |
for(let key of Object.keys(custom_schema)){ | |
const k=custom_schema[key]; | |
newObj[k]=data[key]; | |
} | |
// add missing keys | |
for(let k of missingKeys){ | |
newObj[k]=''; | |
} | |
return _.omitBy(newObj, _.isUndefined); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment