The .first() method returns the first _value_ in an OrderedMap. How do I get the first _key_?
var Immutable = require('immutable');
var m = Immutable.OrderredMap({a:1, b:1});
//get first key
m.keySeq().first(); //a
@hufeng is correct. Get the key sequence and pull the first item from it.
In a future major version update, I will likely change this API to return an entry tuple instead of a value, which adheres to Map's iteration behavior.
still not changed?
Would be great to get firstKey and lastKey options in the API, or have first and last return an entry tuple as discussed above :)
Most helpful comment
still not changed?