Skip to main content

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

Parameter

Type

Description

value

unknown

The value to check

separator

string

The separator between parts

isValidPrefix

(value: string) => boolean

Checks that the part before the separator is valid, if present

isValidSuffix

(value: string) => boolean

Checks that the part after the separator (or the entire value if there is no separator) is valid

**Returns:**

boolean