forked from p15670423/monkey
Linting fixes in ValidationErrorMessages.js and ValidationFormats.js
This commit is contained in:
parent
fd1d3404e7
commit
fade717754
|
@ -1,13 +1,13 @@
|
||||||
import {IP, IP_RANGE} from "./ValidationFormats";
|
import {IP, IP_RANGE} from './ValidationFormats';
|
||||||
|
|
||||||
export default function transformErrors(errors) {
|
export default function transformErrors(errors) {
|
||||||
return errors.map(error => {
|
return errors.map(error => {
|
||||||
if (error.name === "type") {
|
if (error.name === 'type') {
|
||||||
error.message = "Field can't be empty."
|
error.message = 'Field can\'t be empty.'
|
||||||
} else if (error.name === "format" && error.params.format === IP_RANGE) {
|
} else if (error.name === 'format' && error.params.format === IP_RANGE) {
|
||||||
error.message = "Invalid IP range, refer to description for valid examples."
|
error.message = 'Invalid IP range, refer to description for valid examples.'
|
||||||
} else if (error.name === "format" && error.params.format === IP) {
|
} else if (error.name === 'format' && error.params.format === IP) {
|
||||||
error.message = "Invalid IP."
|
error.message = 'Invalid IP.'
|
||||||
}
|
}
|
||||||
return error;
|
return error;
|
||||||
});
|
});
|
||||||
|
|
|
@ -15,7 +15,7 @@ function buildIpRangeRegex(){
|
||||||
'^'+ipRegex+'$|', // Single: IP
|
'^'+ipRegex+'$|', // Single: IP
|
||||||
'^'+ipRegex+'-'+ipRegex+'$|', // IP range: IP-IP
|
'^'+ipRegex+'-'+ipRegex+'$|', // IP range: IP-IP
|
||||||
'^'+ipRegex+'/'+cidrNotationRegex+'$|', // IP range with cidr notation: IP/cidr
|
'^'+ipRegex+'/'+cidrNotationRegex+'$|', // IP range with cidr notation: IP/cidr
|
||||||
hostnameRegex, // Hostname: target.tg
|
hostnameRegex // Hostname: target.tg
|
||||||
].join(''))
|
].join(''))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue