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

x/composite_key/mod.ts>compositeKey

Composite keys, TC39 proposal-richer-keys of compositeKey implementation
Go to Latest
function compositeKey
import { compositeKey } from "https://deno.land/x/composite_key@1.0.0/mod.ts";

Return Ref consisting of a component. This allows using a Map, Set and WeakMap to weakly and/or privately associate data with the lifetime of a group of values.

Examples

Example 1

import { compositeKey } from "https://deno.land/x/composite_key@$VERSION/mod.ts";
import {
 assertEquals,
 assertNotEquals,
} from "https://deno.land/std/testing/asserts.ts";

declare const fn: (a: number, b: number) => number;

assertEquals(compositeKey(fn, 0, 1), compositeKey(fn, 0, 1));
assertNotEquals(compositeKey(fn, 0, 0), compositeKey(fn, 0, 1));

Parameters

...parts: [object, ...unknown[]] | [...unknown[], object]