Skip to main content
Module

x/bettermap/mod.ts>BetterMap#find

An extension of the Map class with more Array-like features.
Latest
method BetterMap.prototype.find
import { BetterMap } from "https://deno.land/x/bettermap@v1.3.0/mod.ts";

Find an element from the Map.

const map = new BetterMap<string, number>("People");
map.set("Doraemon", 10);
map.set("Dora", 28);
console.log(map.find(v => v > 10)); // 28

Parameters

fn: (v: V, k: K) => boolean

Function to be passed.

Returns

V | undefined

A value from the map. If none found, returns undefined.