Skip to content

getPreviousMapEntry

getPreviousMapEntry<K, V>(map, currentKey): [K, V] | undefined

Defined in: utils/map.ts:8

Returns the map entry that comes before the entry with the provided key. If the provided key is the first entry in the map or doesn’t exist in the map, the function returns undefined.

Type Parameters

K = any

V = any

Parameters

map

Map<K, V>

The map to search in.

currentKey

any

The key of the map entry that comes after the desired entry.

Returns

[K, V] | undefined

The map entry that comes before the entry with the provided key, or undefined if such an entry doesn’t exist.