Debug label: Object.prototype.toString reports [object CborSet].
The number of elements in the set.
StaticfromCreate a CborSet from any iterable of encodable items. Duplicates (by canonical encoding) are removed.
NOTE: strings are iterable - CborSet.from("abc") is a THREE-element
set of one-character strings, not a single-element set. Wrap in an
array (CborSet.from(["abc"])) for the latter.
Add an element to the set (no effect if an element with the same
canonical encoding already exists). Returns this for chaining, like
JS Set.add.
Internal
Add an element that must sort strictly after every element added so far (canonical CBOR-byte order). The decoder uses this to reject misordered or duplicate elements.
The decoder's append path; not part of the supported surface.
Check whether the set contains an element (by canonical encoding).
Remove an element from the set.
true if the element was removed, false if not found
Remove all elements from the set.
Iterate the stored Cbor elements lazily in canonical order.
NOTE: this yields the stored Cbor nodes. Use toArray() for an eager
array of extracted native values.
JS Set.keys() mirror - identical to values().
Encode the set as an (untagged) CBOR array of its elements, in canonical ascending CBOR-byte order.
StaticfromThe ToCbor protocol: encodes as the untagged canonical array.
Encode straight to deterministic CBOR bytes.
Convert to a JavaScript Set of extracted native values (see CborNative for the Map/Tagged asymmetries).
Eagerly extract all elements as native values, in canonical order.
Convert to a string listing the extracted elements.
Convert to JSON (array of extracted values).
CBOR Set type, encoded as a plain (untagged) array.
Internally uses a CborMap to ensure unique elements with deterministic ordering. Elements are ordered by their CBOR encoding (lexicographic byte order).
Example