You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							79 lines
						
					
					
						
							2.7 KiB
						
					
					
				
			
		
		
	
	
							79 lines
						
					
					
						
							2.7 KiB
						
					
					
				"use strict"; | 
						|
 | 
						|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | 
						|
 | 
						|
exports.__esModule = true; | 
						|
exports.default = exports.array = exports.object = exports.boolean = exports.date = exports.number = exports.string = exports.mixed = void 0; | 
						|
 | 
						|
var _printValue = _interopRequireDefault(require("./util/printValue")); | 
						|
 | 
						|
var mixed = { | 
						|
  default: '${path} is invalid', | 
						|
  required: '${path} is a required field', | 
						|
  oneOf: '${path} must be one of the following values: ${values}', | 
						|
  notOneOf: '${path} must not be one of the following values: ${values}', | 
						|
  notType: function notType(_ref) { | 
						|
    var path = _ref.path, | 
						|
        type = _ref.type, | 
						|
        value = _ref.value, | 
						|
        originalValue = _ref.originalValue; | 
						|
    var isCast = originalValue != null && originalValue !== value; | 
						|
    var msg = path + " must be a `" + type + "` type, " + ("but the final value was: `" + (0, _printValue.default)(value, true) + "`") + (isCast ? " (cast from the value `" + (0, _printValue.default)(originalValue, true) + "`)." : '.'); | 
						|
 | 
						|
    if (value === null) { | 
						|
      msg += "\n If \"null\" is intended as an empty value be sure to mark the schema as `.nullable()`"; | 
						|
    } | 
						|
 | 
						|
    return msg; | 
						|
  } | 
						|
}; | 
						|
exports.mixed = mixed; | 
						|
var string = { | 
						|
  length: '${path} must be exactly ${length} characters', | 
						|
  min: '${path} must be at least ${min} characters', | 
						|
  max: '${path} must be at most ${max} characters', | 
						|
  matches: '${path} must match the following: "${regex}"', | 
						|
  email: '${path} must be a valid email', | 
						|
  url: '${path} must be a valid URL', | 
						|
  trim: '${path} must be a trimmed string', | 
						|
  lowercase: '${path} must be a lowercase string', | 
						|
  uppercase: '${path} must be a upper case string' | 
						|
}; | 
						|
exports.string = string; | 
						|
var number = { | 
						|
  min: '${path} must be greater than or equal to ${min}', | 
						|
  max: '${path} must be less than or equal to ${max}', | 
						|
  lessThan: '${path} must be less than ${less}', | 
						|
  moreThan: '${path} must be greater than ${more}', | 
						|
  notEqual: '${path} must be not equal to ${notEqual}', | 
						|
  positive: '${path} must be a positive number', | 
						|
  negative: '${path} must be a negative number', | 
						|
  integer: '${path} must be an integer' | 
						|
}; | 
						|
exports.number = number; | 
						|
var date = { | 
						|
  min: '${path} field must be later than ${min}', | 
						|
  max: '${path} field must be at earlier than ${max}' | 
						|
}; | 
						|
exports.date = date; | 
						|
var boolean = {}; | 
						|
exports.boolean = boolean; | 
						|
var object = { | 
						|
  noUnknown: '${path} field cannot have keys not specified in the object shape' | 
						|
}; | 
						|
exports.object = object; | 
						|
var array = { | 
						|
  min: '${path} field must have at least ${min} items', | 
						|
  max: '${path} field must have less than or equal to ${max} items' | 
						|
}; | 
						|
exports.array = array; | 
						|
var _default = { | 
						|
  mixed: mixed, | 
						|
  string: string, | 
						|
  number: number, | 
						|
  date: date, | 
						|
  object: object, | 
						|
  array: array, | 
						|
  boolean: boolean | 
						|
}; | 
						|
exports.default = _default; |