Using the keySeq()/ method, valueSeq()you get a sequence of keys / values. Then you can repeat it, for example with forEach():
let mapOfMaps = Immutable.fromJS({
abc: {
id: 1,
type: 'request'
},
def: {
id: 2,
type: 'response'
},
ghi: {
type: 'cancel'
},
jkl: {
type: 'edit'
}
});
// iterate keys
mapOfMaps.keySeq().forEach(k => console.log(k));
// iterate values
mapOfMaps.valueSeq().forEach(v => console.log(v));
Alternatively, you can iterate in a single loop with entrySeq():
mapOfMaps.entrySeq().forEach(e => console.log(`key: ${e[0]}, value: ${e[1]}`));
source
share