From the docs: Map#keys
I get the keys of a Map and loop through it to transform them into an array. Is there a one line code to cleanly convert these keys into an array?
If you can use ES6:
var map = Immutable.fromJS({
a: 1,
b: 2,
c: {
d: "asdf"
}
});
var [...arr] = map.keys();
console.log(arr); // ["a", "b", "c"]
Or
var arr = Array.from(map.keys());
console.log(arr); // ["a", "b", "c"]