class-validator-extended
Version:
Additional validators for class-validator.
21 lines (20 loc) • 769 B
TypeScript
import type { ValidationOptions } from 'class-validator';
/** @hidden */
export declare const MAP_CONTAINS = "mapContains";
/**
* Checks if the given value is a [Map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map)
* and contains all required values.
*
* #### Example
* ```typescript
* // Ensure the map contains (at least) 'foo' and 'bar'.
* @MapContains(['foo', 'bar'])
* values: Map<number, string>
* ```
*
* @category Map
* @param required The values required in the given map.
* @param options Generic class-validator options.
* @typeParam Value The type of values to check for.
*/
export declare function MapContains<Value = unknown>(required: Iterable<Value>, options?: ValidationOptions): PropertyDecorator;