I can have different version of an object:
myObject1 = {
color: 'red',
size : 'big',
name : 'Beautiful red',
count: 2
};
myObject2 = {
color: 'blue',
name : 'Awesome blue',
count : null
};
I need a helper to keep only value i want and which exist :
function myHelper() {
?????
}
myHelper(myObject1, ['color','size','count']) // => { color: 'red', size : 'big', count:2}
myHelper(myObject2, ['color','size','count']) // => { color: 'blue'}
Anyone already created it ?