Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | 22x 15x 9x 9x 9x 9x 9x 9x | /* eslint-disable max-len */ import is from 'is_js'; export const minLength = (name, value, schema) => ({ isValid: is.equal(value.length, schema.minLength) || is.above(value.length, schema.minLength), errorText: `${name}'s length should be equal or greater than ${schema.minLength}. Current: ${value.length}` }); export const maxLength = (name, value, schema) => ({ isValid: is.equal(value.length, schema.maxLength) || is.under(value.length, schema.maxLength), errorText: `${name}'s length should be equal or less than ${schema.maxLength}. Current: ${value.length}` }); export const include = (name, value, schema) => ({ isValid: is.include(value, schema.include), errorText: `${name} should include ${schema.include}. Current: ${value}` }); export const exclude = (name, value, schema) => ({ isValid: is.not.include(value, schema.exclude), errorText: `${name} should not include ${schema.exclude}. Current: ${value}` }); export const startWith = (name, value, schema) => ({ isValid: is.startWith(value, schema.startWith), errorText: `${name} should start with '${schema.startWith}'.` }); export const notStartWith = (name, value, schema) => ({ isValid: is.not.startWith(value, schema.notStartWith), errorText: `${name} should not start with '${schema.notStartWith}'.` }); export const endWith = (name, value, schema) => ({ isValid: is.endWith(value, schema.endWith), errorText: `${name} should end with '${schema.endWith}'.` }); export const notEndWith = (name, value, schema) => ({ isValid: is.not.endWith(value, schema.notEndWith), errorText: `${name} should not end with '${schema.notEndWith}'.` }); |