Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Latest
function toJsonValue
import { toJsonValue } from "https://deno.land/x/authlete_deno@v1.2.10/src/type/base_extended_enum.ts";

Convert instance(s) of TExtendedEnum class to the corresponding JSON value(s). For example, if you pass ResponseCode.CODE (an instance of ResponseType class) to this method, the method returns 'CODE' (a string value).

NOTE: this method is supposed to be used by class-transformer (the object mapper we internally use). Manual use of this method is not recommended.

Type Parameters

TExtendedEnum extends BaseExtendedEnum

Parameters

An instance of an 'extended enum' class (a class that extends BaseExtendedEnum class) or an array of the 'extended enum' class. The 'extended enum' class must have a property pointing to the instance.

Returns

undefined | string | string[]

A string or array of string that corresponds to the TExtendedEnum class.