Skip to content

pk (class-validator adapter)

const pk: object;

Defined in: adapters/class-validator.ts:45

class-validator decorators for Pakistani identifiers. They work in NestJS DTOs with the built-in ValidationPipe; no NestJS package is needed. Combine with @IsOptional() for optional fields.

Name Type
cnic() (options) => PropertyDecorator
phone() (options) => PropertyDecorator
iban() (options) => PropertyDecorator
ntn() (options) => PropertyDecorator
strn() (options) => PropertyDecorator
landline() (options) => PropertyDecorator
passport() (options) => PropertyDecorator
vehiclePlate() (options) => PropertyDecorator
codPhone() (options) => PropertyDecorator
amount() (options) => PropertyDecorator
import { IsOptional } from 'class-validator';
import { IsCNIC, IsPakPhone } from 'pakdatakit/class-validator';
class CreateCustomerDto {
@IsCNIC()
cnic!: string;
@IsOptional()
@IsPakPhone({ message: 'Enter a Pakistani mobile number' })
phone?: string;
}