Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

js Validating maps


// If your field is a map and you want to perform 
// validation of each item in the map you must 
// specify a special each: true decorator option:

import { MinLength, MaxLength } from 'class-validator';

export class Post {
  @MaxLength(20, {
    each: true,
  })
  tags: Map<string, string>;
}
Source by github.com #
 
PREVIOUS NEXT
Tagged: #js #Validating #maps
ADD COMMENT
Topic
Name
1+1 =