class-validator-extended
Version:
Additional validators for class-validator.
35 lines (34 loc) • 1.14 kB
TypeScript
import type { ValidationOptions } from 'class-validator';
/** @hidden */
export declare const NOT_MATCHES = "notMatches";
/**
* @overload
* @param {RegExp} pattern The regular expression to validate against.
* @param options Generic class-validator options.
*/
/**
* @overload
* @param {string} pattern The regular expression to validate against.
* @param {string} modifiers The modifiers for the given regular expression.
* @param options Generic class-validator options.
*/
/**
* Checks if the given value is a string that does not match the given regular expression.
*
* #### Example
* ```typescript
* // Ensure the value does not start with "foo".
* @NotMatches(/^foo/)
* value: string = 'bar'
*
* // Ensure the value does not include "foo", ignoring case.
* @NotMatches('foo', 'i')
* value: string = 'bar'
* ```
*
* @category String
* @param {string | RegExp} pattern
* @param options
*/
export declare function NotMatches(pattern: RegExp, options?: ValidationOptions): PropertyDecorator;
export declare function NotMatches(pattern: string, modifiers?: string, options?: ValidationOptions): PropertyDecorator;