-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Added the option "cut" in "string-type". - Added comments when required. - Updated documentation. - Updated dev dependencies.
- Loading branch information
1 parent
f65f13b
commit def7b23
Showing
11 changed files
with
166 additions
and
39 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,5 +1,12 @@ | ||
import { BaseType } from './base-type.js'; | ||
|
||
export interface DateType extends BaseType<'date'> { | ||
/** | ||
* If this value is `true`, the `Auditor` instance will try to parse strings | ||
* with a valid JSON Date format (like `'2022-12-31T03:00:00.000Z'`). If the | ||
* convertion is sucessfull, the returned value will be a `Date` type, | ||
* otherwise, the `Auditor` instance will throws an `InvalidJSONDateError` | ||
* instance. | ||
*/ | ||
fromJSON?: boolean; | ||
} |
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 |
---|---|---|
@@ -1,6 +1,17 @@ | ||
import { BaseType } from './base-type.js'; | ||
|
||
export interface NumberType extends BaseType<'number'> { | ||
/** | ||
* If the incoming value has __lower__ than the value setted, | ||
* the `Auditor` instance will throws an `WrongLengthError` | ||
* instance. | ||
*/ | ||
min?: number; | ||
|
||
/** | ||
* If the incoming value has __higher__ than the value setted, | ||
* the `Auditor` instance will throws an `WrongLengthError` | ||
* instance. | ||
*/ | ||
max?: number; | ||
} |
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 |
---|---|---|
@@ -1,7 +1,27 @@ | ||
import { BaseType } from './base-type.js'; | ||
|
||
export interface StringType extends BaseType<'string'> { | ||
/** | ||
* Trims the incoming string __before to make any length validation.__ | ||
*/ | ||
trim?: boolean; | ||
|
||
/** | ||
* If the incoming string has a length __lower__ than the value setted, | ||
* the `Auditor` instance will throws an `WrongLengthError` instance. | ||
*/ | ||
min?: number; | ||
|
||
/** | ||
* If the incoming string has a length __higher__ than the value setted, | ||
* the `Auditor` instance will throws an `WrongLengthError` instance. | ||
*/ | ||
max?: number; | ||
|
||
/** | ||
* If this option is enabled, when the length of the incoming string is | ||
* longer than the max value settled, the output value will be cutted | ||
* instead to throws an error. | ||
*/ | ||
cut?: boolean; | ||
} |
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