Skip to content

Latest commit

 

History

History
40 lines (32 loc) · 613 Bytes

README.md

File metadata and controls

40 lines (32 loc) · 613 Bytes

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',
};
``