Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
export const maxLength = (length: number, rule?: Rule): Rule => (data, path) => {
return data.length <= length ? (rule? rule(data,path) : []) : [createMaxLengthWarning(data, path, length)];
}
export const isSortValid = (data: string = ""):boolean => {
const pattern = /^([a-z_]+:(?:asc|desc))(?:,([a-z_]+:(?:asc|desc)))*$/ig
return pattern.test(data);
}
export const isValidSortObject = (rule?: Rule): Rule => (data, path) => {
return isSortValid(data) ? (rule? rule(data,path) : []) : [createInvalidSortObjectWarning(data, path)];
}
export const isEmail = checkRegex(/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/, createInvalidEmailWarning)