I have to remove unwanted object properties that do not match my model. How can I achieve it with Lodash?
My model is:
var model = { fname: null, lna
You can use _.omit() for emitting the key from a JSON array if you have fewer objects:
_.omit()
_.forEach(data, (d) => { _.omit(d, ['keyToEmit1', 'keyToEmit2']) });
If you have more objects, you can use the reverse of it which is _.pick():
_.pick()
_.forEach(data, (d) => { _.pick(d, ['keyToPick1', 'keyToPick2']) });