Tip of the day — Use lodash omit function

_.omit (obj, keys)

This lodash helper function finds key(s) in the object and drops that key(s) from the object.

let object = { ‘a’: 1, ‘b’: ‘2’, ‘c’: 3 };

object = _.omit(object, 'c');
// => { ‘a’: 1, ‘b’: ‘2’}

If we use _.omit this way, it doesn’t make sense because it is equvalant to what JavaScript delete operator does:

delete object.a;

This helper comes handy when you want to remove array of keys:

var object = { ‘a’: 1, ‘b’: ‘2’, ‘c’: 3 };

object = _.omit(object, [‘a’, ‘c’]);
// => { ‘b’: ‘2’ }