Skip to content

Commit 3953bce

Browse files
Harrison IfeanyichukwuHarrison Ifeanyichukwu
authored andcommitted
feat: added objectId validation type
1 parent 0e1de07 commit 3953bce

5 files changed

Lines changed: 306 additions & 147 deletions

File tree

src/@types/index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ export type DataType =
8484
| 'text'
8585
| 'title'
8686
| 'name'
87+
| 'objectId'
8788
| 'email'
8889
| 'url'
8990
| 'phoneNumber'

src/@types/rules/TextRules.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ interface BaseTextRule<F extends string> extends BaseRule<F> {
8080

8181
//text rules
8282
interface TextRule<F extends string> extends BaseTextRule<F> {
83-
type?: 'text' | 'title' | 'name';
83+
type?: 'text' | 'title' | 'name' | 'objectId';
8484
}
8585

8686
interface EmailRule<F extends string> extends BaseTextRule<F> {

src/Handler.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,8 @@ export default class Handler<F extends string = string, Exports = Data<F>> {
130130

131131
name: 'validateText',
132132

133+
objectId: 'validateObjectId',
134+
133135
date: 'validateDate',
134136

135137
//integer validation methods

0 commit comments

Comments
 (0)