The index of an item in OrderedMap

You can get the key sequence from the map:

let index = map.keySeq().findIndex(k => k === key);

See the docs for more info.

Alternatively, you could explicitly iterate over the keys and compare them:

function findIndexOfKey(map, key) {
    let index = -1;
    for (let k of map.keys()) {
        index += 1;
        if (k === key) {
            break
        }
    }
    return index;
}

the best way to do it would be the way immutablejs inners does it.

Like this:

const index = orderedMap._map.get(k);

https://github.com/facebook/immutable-js/blob/master/src/OrderedMap.js#L43