Skip to content

Commit 6ce58c4

Browse files
pdpolstuyam
authored andcommitted
use and not or (#170)
1 parent 97f6b6c commit 6ce58c4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/simple-react-validator.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class SimpleReactValidator {
3939
not_in : {message: 'The selected :attribute must not be :values.', rule: (val, params) => !params.includes(val), messageReplace: (message, params) => message.replace(':values', this.helpers.toSentence(params))},
4040
not_regex : {message: 'The :attribute must not match the required pattern.', rule: (val, params) => !this.helpers.testRegex(val, typeof params[0] === 'string' || params[0] instanceof String ? new RegExp(params[0]) : params[0])},
4141
numeric : {message: 'The :attribute must be a number.', rule: val => this.helpers.numeric(val)},
42-
phone : {message: 'The :attribute must be a valid phone number.', rule: val => this.helpers.testRegex(val,/^(\+?\d{0,4})?\s?-?\s?(\(?\d{3}\)?)\s?-?\s?(\(?\d{3}\)?)\s?-?\s?(\(?\d{4}\)?)$/) || !this.helpers.testRegex(/^\b(\d)\1{8,}\b$/)},
42+
phone : {message: 'The :attribute must be a valid phone number.', rule: val => this.helpers.testRegex(val,/^(\+?\d{0,4})?\s?-?\s?(\(?\d{3}\)?)\s?-?\s?(\(?\d{3}\)?)\s?-?\s?(\(?\d{4}\)?)$/) && !this.helpers.testRegex(/^\b(\d)\1{8,}\b$/)},
4343
regex : {message: 'The :attribute must match the required pattern.', rule: (val, params) => this.helpers.testRegex(val, typeof params[0] === 'string' || params[0] instanceof String ? new RegExp(params[0]) : params[0])},
4444
required : {message: 'The :attribute field is required.', rule: val => !this.helpers.isBlank(val), required: true },
4545
size : {message: 'The :attribute must be :size:type.', rule: (val, params) => this.helpers.size(val, params[1]) == parseFloat(params[0]), messageReplace: (message, params) => message.replace(':size', params[0]).replace(':type', this.helpers.sizeText(params[1]))},

0 commit comments

Comments
 (0)