File tree 1 file changed +37
-0
lines changed
1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ export type ValidationRuleName =
4
4
| "array"
5
5
| "boolean"
6
6
| "class"
7
+ | "currency"
7
8
| "custom"
8
9
| "date"
9
10
| "email"
@@ -103,6 +104,41 @@ export interface RuleClass<T = any> extends RuleCustom {
103
104
instanceOf ?: T ;
104
105
}
105
106
107
+ /**
108
+ * Validation schema definition for "currency" built-in validator
109
+ * @see https://github.com/icebob/fastest-validator#currency
110
+ */
111
+ export interface RuleCurrency extends RuleCustom {
112
+ /**
113
+ * Name of built-in validator
114
+ */
115
+ type : "currency" ;
116
+ /**
117
+ * The currency symbol expected in string (as prefix)
118
+ * @default null
119
+ */
120
+ currencySymbol ?: string ;
121
+ /**
122
+ * Toggle to make the currency symbol optional in string
123
+ * @default false
124
+ */
125
+ symbolOptional ?: boolean ;
126
+ /**
127
+ * Thousand place separator character
128
+ * @default ','
129
+ */
130
+ thousandSeparator ?: string ;
131
+ /**
132
+ * Decimal place character
133
+ * @default '.'
134
+ */
135
+ decimalSeparator ?: string ;
136
+ /**
137
+ * Custom regular expression to validate currency strings
138
+ */
139
+ customRegex ?: RegExp | string ;
140
+ }
141
+
106
142
/**
107
143
* Validation schema definition for "date" built-in validator
108
144
* @see https://github.com/icebob/fastest-validator#date
@@ -754,6 +790,7 @@ export type ValidationRuleObject =
754
790
| RuleArray
755
791
| RuleBoolean
756
792
| RuleClass
793
+ | RuleCurrency
757
794
| RuleDate
758
795
| RuleEmail
759
796
| RuleEqual
You can’t perform that action at this time.
0 commit comments