Skip to content

Commit

Permalink
🔨 refactor(index.ts): simplify constructor signature by using type al…
Browse files Browse the repository at this point in the history
…iases for rules and messages parameters
  • Loading branch information
Codycody31 committed Dec 13, 2023
1 parent ac30af9 commit 6282b51
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,15 +150,11 @@ class Validator {

/**
* Creates an instance of the Validator class.
* @param {{ [key: string]: Rule }} rules - The validation rules for each field.
* @param {{ [key: string]: Message }} messages - The error messages for each rule.
* @param {Rules} rules - The validation rules for each field.
* @param {Messages} messages - The error messages for each rule.
* @param {Options} [options] - Additional options for validation.
*/
constructor(
rules: { [key: string]: Rule },
messages: { [key: string]: Message },
options?: Options
) {
constructor(rules: Rules, messages: Messages, options?: Options) {
this.rules = rules;
this.messages = messages;
this.options = options || {};
Expand Down

0 comments on commit 6282b51

Please sign in to comment.