Skip to main content
Version: Next

CommonValidatorFunctions.isValidPrefixAndOrSuffix()

Home > @backstage/catalog-model > CommonValidatorFunctions > isValidPrefixAndOrSuffix

Checks that the value is on the form <suffix> or <prefix><separator><suffix>, and validates those parts separately.

Signature:

static isValidPrefixAndOrSuffix(value: unknown, separator: string, isValidPrefix: (value: string) => boolean, isValidSuffix: (value: string) => boolean): boolean;

Parameters

ParameterTypeDescription
valueunknownThe value to check
separatorstringThe separator between parts
isValidPrefix(value: string) => booleanChecks that the part before the separator is valid, if present
isValidSuffix(value: string) => booleanChecks that the part after the separator (or the entire value if there is no separator) is valid

Returns:

boolean