Skip to main content

has-prefix

$has-prefix

Check that the provided string value starts with the prefix value

Parameters

  • match (string, required): The required prefix string.

Example

// Require all feature flag names to start with 'ff_'
new Schema('string').validator({'$has-prefix': 'ff_'})

// Require environment variables to start with 'APP_'
new Schema('object', {
envKey: new Schema('string').validator({'$has-prefix': 'APP_'}),
})