enum-keys-values-entries
v1.0.6
Published
Get just the keys (left hand side), values (right hand side), or entries (tuple of [key, value]) of a TypeScript enum
Downloads
922
Maintainers
Readme
enum-keys-values-entries
Get just the keys (left hand side), values (right hand side), or entries (tuple of [key, value]) of a TypeScript enum.
Install
You can install via npm or yarn.
npm
npm install --save enum-keys-values-entries
yarn
yarn add enum-keys-values-entries
Usage
Keys
import { Enum } from 'enum-keys-values-entries';
enum MyEnum {
Cake = 1,
'Ice Cream' = 2,
Pie = 3,
}
const keys = Enum.keys(MyEnum);
const values = Enum.values(MyEnum);
const entries = Enum.entries(MyEnum);