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

x/composite_key/mod.ts>compositeSymbol

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

Return Symbol consisting of a component. This allows strongly attaching data to an object that is associated with a group of values.

Examples

Example 1

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

declare const object: object;

assertEquals(compositeSymbol(0, 1), compositeSymbol(0, 1));
assertEquals(compositeSymbol(0, object), compositeSymbol(0, object));

assertNotEquals(compositeSymbol(0), compositeSymbol(1));
assertNotEquals(compositeSymbol(0, {}), compositeSymbol(0, {}));

Parameters

...parts: readonly unknown[]

Returns

symbol