-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor event validation and now validate events on dispatch (#5)
- Loading branch information
1 parent
1159f43
commit 8de72af
Showing
10 changed files
with
530 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
'use strict'; | ||
|
||
/** | ||
* ValidationResult Class | ||
*/ | ||
class ValidationResult { | ||
/** | ||
* Construct an ValidationResult | ||
* | ||
* @param {EventValidatorInterface} validator | ||
* @param {EventInterface} event | ||
* @param {boolean} passes | ||
* @param {string[]} [errors=[]] | ||
*/ | ||
constructor(validator, event, passes, errors = []) { | ||
/** | ||
* @type {EventValidatorInterface} | ||
*/ | ||
this.validator = validator; | ||
|
||
/** | ||
* @type {EventInterface} | ||
*/ | ||
this.event = event; | ||
|
||
/** | ||
* @type {boolean} | ||
*/ | ||
this.passes = passes; | ||
|
||
/** | ||
* @type {boolean} | ||
*/ | ||
this.fails = !passes; | ||
|
||
/** | ||
* @type {string[]} | ||
*/ | ||
this.errors = errors; | ||
} | ||
} | ||
|
||
module.exports = ValidationResult; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.