Skip to main content
The Deno 2 Release Candidate is here
Learn more
Module

x/enum/lib/enum.js>default

Enum is a javascript module that introduces the Enum Type. It works for node.js, in the browser and for deno.
Latest
class default
import { default } from "https://deno.land/x/enum@v3.0.4/lib/enum.js";

Represents an Enum with enum items.

Constructors

new
default(map, options)

Methods

extend(map)

Extends the existing Enum with a New Map.

Define freezeEnums() as a property of the prototype. make enumerable items nonconfigurable and deep freeze the properties. Throw Error on property setter.

get(key, offset)

Returns the appropriate EnumItem.

getKey(value)

Returns the appropriate EnumItem key.

Returns the appropriate EnumItem value.

isDefined(enumItem)

Return true whether the enumItem parameter passed in is an EnumItem object and has been included as constant of this Enum

set(
buffer,
offset,
value,
)

Sets the Enum "value" onto the give buffer at the specified offset. Part of the ref "Type interface".

Returns JSON object representation of this Enum.

Static Methods

register(key?)

Registers the Enum Type globally in node.js.