Immutable-js: Map.selectKeys

Created on 30 Oct 2014  Â·  4Comments  Â·  Source: immutable-js/immutable-js

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.

Most helpful comment

+1 to making it first-class.

All 4 comments

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

evenstensberg picture evenstensberg  Â·  4Comments

coodoo picture coodoo  Â·  3Comments

kopax picture kopax  Â·  3Comments

davidwparker picture davidwparker  Â·  3Comments

jamesgpearce picture jamesgpearce  Â·  4Comments