Conversion and extraction utilities for enums with TypeScript type-safety.
npm install enum-utilsConversion and extraction utilities for enums with TypeScript type-safety.





``sh`
$ npm install enum-utils
Node.js / CommonJS:
`typescript`
const { EnumUtils } = require('enum-utils')
ESNext / TypeScript:
`typescript`
import { EnumUtils } from 'enum-utils'
Returns an array of key/values of the enumerable properties of an enum.
Type parameters:
#### T
Parameters:
| Name | Type | Description |
| ---- | ---- | ----------- |
| e | T | Enum value. |
Returns: [string, T][]
---
Returns the names of the enumerable properties and methods of an enum.
Type parameters:
#### T
Parameters:
| Name | Type | Description |
| ---- | ---- | ----------- |
| e | T | Enum value. |
Returns: string[]
---
Returns a value to key mapping object for the input enum.
Note: Reverse mapping keys are omitted.
Type parameters:
#### T
Parameters:
| Name | Type | Description |
| ---- | ---- | ----------- |
| e | T | Enum value. |
Returns: object
---
Returns an array of values of the enumerable properties of an enum.
Type parameters:
#### T
Parameters:
| Name | Type | Description |
| ---- | ---- | ----------- |
| e | T | Enum value. |
Returns: T[]
---
Returns a key -> value mapping object for the input enum.
Note: Reverse mapping keys are omitted.
Type parameters:
#### T
Parameters:
| Name | Type |
| ----- | ---- |
| input | T |
Returns: object`
---
- http-method-enum
- status-code-enum
Follow @typeslick on Twitter for the latest
updates and new project announcements.
- Loomble