class BencodexDictionary
implements Dictionary
import { BencodexDictionary } from "https://deno.land/x/bencodex@0.2.2/src/dict.ts";
A Dictionary implementation that complies with the Bencodex specification. Unlike Map, this implementation allows only keys of type Key and values of type Value, and in particular, it actually compares Uint8Array keys by their contents instead of their references.
Note that this implementation does not guarantee the stable order of entries; it can vary depending on the platform and the version of this library.
Examples
Constructing a dictionary
Constructing a dictionary
const dict = new BencodexDictionary([
["foo", 123n],
["bar", "baz"],
]);
Constructors
Creates a new BencodexDictionary instance.
Methods
forEach(callback: () => void, thisArg?: unknown): void
{@inheritDoc Dictionary.forEach}
[Symbol.for("Deno.customInspect")](inspect: (_: unknown, options: unknown) => string, options: { compact: boolean; depth: number; sorted: boolean; trailingComma: boolean; }): string
[Symbol.for("nodejs.util.inspect.custom")](): string
_: number,
options: { compact: number | boolean; depth: number; sorted: boolean; },
inspect: (_: unknown, options: unknown) => string,
[Symbol.iterator](): Iterator<readonly [Key, Value]>
Gets an iterator which iterates over the key-value pairs in this
dictionary. This method is equivalent to Dictionary.entries()
.