Skip to content

nurulhudaapon/enum-map-generator

Repository files navigation

Enum Map Generator README

Generator mapper from TS enum or JS enum like object.

demo

Keybinding: ALT+SHIFT+M

//Enum
enum MyStatus {
    Dying = 0,
    Flying = 1,
    Crying = 2,
};

//Result
export const MY_STATUS_MAPPING: Record<MyStatus, string> = {
    [MyStatus.Dying]: 'Dying',
	[MyStatus.Flying]: 'Flying',
	[MyStatus.Crying]: 'Crying',
};
//Enum like object
const MyStatus = {
    Dying: 0,
    Flying: 1,
    Crying: 2,
};

//Result
const MY_STATUS_MAPPING = {
    [MyStatus.Dying]: 'Dying',
	[MyStatus.Flying]: 'Flying',
	[MyStatus.Crying]: 'Crying',
};
``

Releases

No releases published

Packages

No packages published