I believe I want something like Clojure’s select-keys.
The mutable JS equivalent (using Lodash):
var foo = { bar: 0, baz: 0 };
_.pick(foo, 'bar'); // => { bar: 0 }
I can't see anything like this on Immutable.Map, but I could be mislead – this is my first time using immutable data structures.
Check out https://github.com/facebook/immutable-js/wiki/Predicates#pick--omit
Thanks @tgriesser
Personally I think this is common enough to be a first-class API.
Especially as when picking keys from an existing object, we should only need to iterate over the keys to pick.
+1 to making it first-class.
Most helpful comment
+1 to making it first-class.