numberRule
Αυτό το περιεχόμενο δεν είναι ακόμη διαθέσιμο στη γλώσσα σου.
numberRule<
TOptions>(options):NumberRule<TOptions>
Defined in: packages/core/domain/rules/number.rule.ts:95
Defines the rule for one number field of an aggregate: declared once, used by the aggregate to parse the value, and read by other layers (such as a request schema) for its limits.
parse(value) checks, in this order:
nullorundefined:null, or arequiredviolation;- not a number: a
typeviolation (a numeric string is not converted); NaNor an infinity: afiniteviolation;- with
integer, not a safe integer: anintegerviolation; min, thenmax.
Type Parameters
Section titled “Type Parameters”TOptions
Section titled “TOptions”TOptions extends NumberRuleOptions
Parameters
Section titled “Parameters”options
Section titled “options”TOptions
The field name, its constraints and its error.
Returns
Section titled “Returns”NumberRule<TOptions>
The frozen rule.
Throws
Section titled “Throws”TypeError when an option is invalid: an empty field, a bound that
is not a finite number, or min above max.