Skip to content

@technobuddha > library > Programming > Variables

Function: macroCase()

ts
function macroCase(input: string): string;

Defined in: macro-case.ts:18

Convert an identifier string to macro case

Parameters

ParameterTypeDescription
inputstringThe identifier string

Returns

string

the identifier in macro case

Example

typescript
macroCase('hello world'); // 'HELLO_WORLD'
macroCase('HelloWorld'); // 'HELLO_WORLD'
macroCase('foo_bar-baz'); // 'FOO_BAR_BAZ'
macroCase('FOO BAR'); // 'FOO_BAR'