/** * Transforms the values of the map using the specified function. * * @tsplus static ImmutableMap.Aspects mapWithIndex * @tsplus pipeable ImmutableMap mapWithIndex */ export function mapWithIndex(f: (key: K, value: V) => B) { return (self: ImmutableMap): ImmutableMap => { const map = new Map() for (const [key, value] of self.internalMap) { map.set(key, f(key, value)) } return new ImmutableMap(map) } }