stack

Home > @infiniteobjects/core-library-web > ChangeCase > toConstant

ChangeCase.toConstant() method

Converts string to constant case. i.e. What an ENVIRONMENT_VAR looks like

Signature:

static toConstant(str: string): string;

Parameters

Parameter Type Description
str string  

Returns:

string

Example

ChangeCase.toConstant('Foo Bar');
// => 'FOO_BAR'

ChangeCase.toConstant('fooBar');
// => 'FOO_BAR'

ChangeCase.toConstant('__FOO_BAR__');
// => 'FOO_BAR'