validators.js 941 B

1
  1. "use strict";var _type=_interopRequireDefault(require("@d3v4pp/type"));Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=void 0;function _interopRequireDefault(a){return a&&a.__esModule?a:{default:a}}var Validators={required:function required(a,b,c){return!(!1!==c)||a!=null&&null!=a&&""!==a},type:function type(a,b,c){return!(null!=a)||("function"==typeof c?a.constructor===c:(0,_type["default"])(a)===c)},length:function length(a,b,c){if(null==a)return!0;if("number"==typeof c)return a.length===c;var d=c.min,e=c.max;return!(d&&a.length<d)&&!(e&&a.length>e)},size:function size(a,b,c){if(null==a)return!0;if("number"==typeof c)return a===c;var d=c.min,e=c.max;return!(null!=parseInt(d)&&a<d)&&!(null!=parseInt(e)&&a>e)},enum:function _enum(a,b,c){return null==a||c.includes(a)},match:function match(a,b,c){return!(null!=a)||c.test(a)}},_default=Validators;exports["default"]=_default,module.exports=exports.default;