Skip to main content

Function: isValidSecurityTier()

isValidSecurityTier(name): name is SecurityTierName

Defined in: security/SecurityTiers.ts:496

Type-guard that checks whether a string is a valid SecurityTierName.

Parameters

name

string

The string to validate.

Returns

name is SecurityTierName

true if name is one of the five recognised tier names.

Example

const input = getUserInput();
if (isValidSecurityTier(input)) {
const tier = getSecurityTier(input); // input is narrowed to SecurityTierName
}