Home > @infiniteobjects/core-library-web > ChangeCase > toConstant
Converts string
to constant case. i.e. What an ENVIRONMENT_VAR looks like
Signature:
static toConstant(str: string): string;
Parameter | Type | Description |
---|---|---|
str | string |
Returns:
string
ChangeCase.toConstant('Foo Bar');
// => 'FOO_BAR'
ChangeCase.toConstant('fooBar');
// => 'FOO_BAR'
ChangeCase.toConstant('__FOO_BAR__');
// => 'FOO_BAR'