Omit Is Being Removed in Lodash 5

Some alternatives you can use now to stay one step ahead

Robert Dempsey
Level Up Coding
Published in
7 min readApr 11, 2020

--

*** Thank you to tzar for pointing out a bug with my ES6 + Lodash unset method. If this option is used with flattened paths, i.e. level1prop.level2prop you will end up modifying your original object. I’ll leave it here as a faster alternative to ES2019 for multiple properties, but I wouldn’t recommend using it with flattened properties. ***

Lodash, the super popular JavaScript utility library has decided to remove its oh-so handy omit function due to poor performance. In this article, we take a look at some alternatives we can use to omit properties from objects.

Photo by Jason Blackeye on Unsplash

What is _.omit and when would I use it?

Omit is a function that takes an object as an input, along with one or many property names that are you to remove from the resulting new object returned by the function.

In what situations would I need such a function?

--

--