Hacker News new | ask | show | jobs
by bionhoward 1016 days ago
This seems like ramda’s evolve function because it updates with a function instead of a value, and it’s conditional because you’re giving a predicate.

One idea to make this more versatile would be to use a mapping instead of a callable for the whereFn and updateFn in order to simultaneously alter multiple columns of your objects. Also, you could add a path field in order to focus on particular nested paths in your data.

Ultimately, others might be right; this function is intended for use on collections, make sure to avoid using this to enable yourself to have a messy junk drawer of json blobs!