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

x/dexonline/src/utils.ts>valueToEnum

Monorepo containing various tools to work with and aggregate information from Dexonline.
Go to Latest
function valueToEnum
import { valueToEnum } from "https://deno.land/x/dexonline@v3.2.1/src/utils.ts";

Casts a value to an enumerator.

Type Parameters

EnumType extends Record<string, unknown>
optional
EnumValue = EnumType extends Record<string, infer V> ? V : never

Parameters

enumerator: EnumType
  • The enumerator the value belongs to.
value: EnumValue
  • The value to cast.

Returns

EnumValue | undefined

The enumerator value equivalent of the cast value, or undefined if couldn't cast value.