Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/cache_mapset/deps.ts>EmplaceableMap

Maps and Sets with cache replacement policies, TC39 proposal-policy-map-set implementation
Latest
class EmplaceableMap
import { EmplaceableMap } from "https://deno.land/x/cache_mapset@1.0.0/deps.ts";

Map with Emplaceable implementation.

Examples

Example 1

import { EmplaceableMap } from "https://deno.land/x/upsert@$VERSION/mod.ts";
import { assert } from "https://deno.land/std/testing/asserts.ts";

const map = new EmplaceableMap<string, number>();
declare const key: string;

map.emplace(key, {
 insert: () => 0,
 update: (existing) => existing + 1,
});

assert(map.has(key));