Last active
January 31, 2017 13:06
-
-
Save davidep87/f5a677c3857d79f2bf1420c89d896798 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
function pickReplace(obj, objPick){ | |
let no = {}; | |
for(let k of objPick){ | |
if(k in obj){ | |
no[k] = obj[k]; | |
} | |
} | |
return no; | |
} | |
let obj = user; // Example of object | |
let objPick = ['id', 'firstName', 'email']; // what we would like to pick from our obj | |
let entry = pickReplace(obj, objPick); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment