Omit by function?
See original GitHub issueLodash has a neat way to remove all null and undefined keys from an obj: _.omit(obj, v => v == null)
. Currently omit()
only accepts strings - can y’all make it optionally take a function parameter?
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Underscore.js | _.omit() Function - GeeksforGeeks
The _.omit() function is used to return a copy of the object that filtered to omit the blacklisted keys. Syntax: _.omit(object, *keys).
Read more >What is the omit() function in Underscore.js? - Educative.io
With the omit() method of Underscore.js, we can return an object's properties by omitting some specified ones. We only need to specify the...
Read more >Omit object properties based on function - 30 seconds of code
Omits the key-value pairs corresponding to the keys of the object for which the given function returns falsy. Use Object. keys() and Array....
Read more >Underscore.JS - omit method - Tutorialspoint
omit (student, 'name', 'age'); console.log(student1); // Example 2: use omit to exclude age and id using function ...
Read more >How to omit specific properties from an object in JavaScript
function omit (keys, obj) { if (!keys.length) return obj const { [keys.pop()]: omitted, ...rest } = obj; return omit(keys, rest); }.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
R.filter
andR.reject
will work on objects in the way you envision they would: https://goo.gl/Od3t5gSee also omitBy function in ramda adjunct: https://char0n.github.io/ramda-adjunct/2.26.0/RA.html#.omitBy