index.cjs 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757
  1. 'use strict';
  2. var vueDemi = require('vue-demi');
  3. function ownKeys(object, enumerableOnly) {
  4. var keys = Object.keys(object);
  5. if (Object.getOwnPropertySymbols) {
  6. var symbols = Object.getOwnPropertySymbols(object);
  7. enumerableOnly && (symbols = symbols.filter(function (sym) {
  8. return Object.getOwnPropertyDescriptor(object, sym).enumerable;
  9. })), keys.push.apply(keys, symbols);
  10. }
  11. return keys;
  12. }
  13. function _objectSpread2(target) {
  14. for (var i = 1; i < arguments.length; i++) {
  15. var source = null != arguments[i] ? arguments[i] : {};
  16. i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
  17. _defineProperty(target, key, source[key]);
  18. }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
  19. Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
  20. });
  21. }
  22. return target;
  23. }
  24. function _defineProperty(obj, key, value) {
  25. if (key in obj) {
  26. Object.defineProperty(obj, key, {
  27. value: value,
  28. enumerable: true,
  29. configurable: true,
  30. writable: true
  31. });
  32. } else {
  33. obj[key] = value;
  34. }
  35. return obj;
  36. }
  37. function isFunction(val) {
  38. return typeof val === 'function';
  39. }
  40. function isObject(o) {
  41. return o !== null && typeof o === 'object' && !Array.isArray(o);
  42. }
  43. function normalizeValidatorObject(validator) {
  44. return isFunction(validator.$validator) ? _objectSpread2({}, validator) : {
  45. $validator: validator
  46. };
  47. }
  48. function isPromise(object) {
  49. return isObject(object) && isFunction(object.then);
  50. }
  51. function unwrapValidatorResponse(result) {
  52. if (typeof result === 'object') return result.$valid;
  53. return result;
  54. }
  55. function unwrapNormalizedValidator(validator) {
  56. return validator.$validator || validator;
  57. }
  58. function withParams($params, $validator) {
  59. if (!isObject($params)) throw new Error(`[@vuelidate/validators]: First parameter to "withParams" should be an object, provided ${typeof $params}`);
  60. if (!isObject($validator) && !isFunction($validator)) throw new Error(`[@vuelidate/validators]: Validator must be a function or object with $validator parameter`);
  61. const validatorObj = normalizeValidatorObject($validator);
  62. validatorObj.$params = _objectSpread2(_objectSpread2({}, validatorObj.$params || {}), $params);
  63. return validatorObj;
  64. }
  65. function withMessage($message, $validator) {
  66. if (!isFunction($message) && typeof vueDemi.unref($message) !== 'string') throw new Error(`[@vuelidate/validators]: First parameter to "withMessage" should be string or a function returning a string, provided ${typeof $message}`);
  67. if (!isObject($validator) && !isFunction($validator)) throw new Error(`[@vuelidate/validators]: Validator must be a function or object with $validator parameter`);
  68. const validatorObj = normalizeValidatorObject($validator);
  69. validatorObj.$message = $message;
  70. return validatorObj;
  71. }
  72. function withAsync($validator) {
  73. let $watchTargets = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  74. const validatorObj = normalizeValidatorObject($validator);
  75. return _objectSpread2(_objectSpread2({}, validatorObj), {}, {
  76. $async: true,
  77. $watchTargets
  78. });
  79. }
  80. function forEach(validators) {
  81. return {
  82. $validator(collection) {
  83. for (var _len = arguments.length, others = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  84. others[_key - 1] = arguments[_key];
  85. }
  86. return vueDemi.unref(collection).reduce((previous, collectionItem, index) => {
  87. const collectionEntryResult = Object.entries(collectionItem).reduce((all, _ref) => {
  88. let [property, $model] = _ref;
  89. const innerValidators = validators[property] || {};
  90. const propertyResult = Object.entries(innerValidators).reduce((all, _ref2) => {
  91. let [validatorName, currentValidator] = _ref2;
  92. const validatorFunction = unwrapNormalizedValidator(currentValidator);
  93. const $response = validatorFunction.call(this, $model, collectionItem, index, ...others);
  94. const $valid = unwrapValidatorResponse($response);
  95. all.$data[validatorName] = $response;
  96. all.$data.$invalid = !$valid || !!all.$data.$invalid;
  97. all.$data.$error = all.$data.$invalid;
  98. if (!$valid) {
  99. let $message = currentValidator.$message || '';
  100. const $params = currentValidator.$params || {};
  101. if (typeof $message === 'function') {
  102. $message = $message({
  103. $pending: false,
  104. $invalid: !$valid,
  105. $params,
  106. $model,
  107. $response
  108. });
  109. }
  110. all.$errors.push({
  111. $property: property,
  112. $message,
  113. $params,
  114. $response,
  115. $model,
  116. $pending: false,
  117. $validator: validatorName
  118. });
  119. }
  120. return {
  121. $valid: all.$valid && $valid,
  122. $data: all.$data,
  123. $errors: all.$errors
  124. };
  125. }, {
  126. $valid: true,
  127. $data: {},
  128. $errors: []
  129. });
  130. all.$data[property] = propertyResult.$data;
  131. all.$errors[property] = propertyResult.$errors;
  132. return {
  133. $valid: all.$valid && propertyResult.$valid,
  134. $data: all.$data,
  135. $errors: all.$errors
  136. };
  137. }, {
  138. $valid: true,
  139. $data: {},
  140. $errors: {}
  141. });
  142. return {
  143. $valid: previous.$valid && collectionEntryResult.$valid,
  144. $data: previous.$data.concat(collectionEntryResult.$data),
  145. $errors: previous.$errors.concat(collectionEntryResult.$errors)
  146. };
  147. }, {
  148. $valid: true,
  149. $data: [],
  150. $errors: []
  151. });
  152. },
  153. $message: _ref3 => {
  154. let {
  155. $response
  156. } = _ref3;
  157. return $response ? $response.$errors.map(context => {
  158. return Object.values(context).map(errors => errors.map(error => error.$message)).reduce((a, b) => a.concat(b), []);
  159. }) : [];
  160. }
  161. };
  162. }
  163. const req = value => {
  164. value = vueDemi.unref(value);
  165. if (Array.isArray(value)) return !!value.length;
  166. if (value === undefined || value === null) {
  167. return false;
  168. }
  169. if (value === false) {
  170. return true;
  171. }
  172. if (value instanceof Date) {
  173. return !isNaN(value.getTime());
  174. }
  175. if (typeof value === 'object') {
  176. for (let _ in value) return true;
  177. return false;
  178. }
  179. return !!String(value).length;
  180. };
  181. const len = value => {
  182. value = vueDemi.unref(value);
  183. if (Array.isArray(value)) return value.length;
  184. if (typeof value === 'object') {
  185. return Object.keys(value).length;
  186. }
  187. return String(value).length;
  188. };
  189. function regex() {
  190. for (var _len = arguments.length, expr = new Array(_len), _key = 0; _key < _len; _key++) {
  191. expr[_key] = arguments[_key];
  192. }
  193. return value => {
  194. value = vueDemi.unref(value);
  195. return !req(value) || expr.every(reg => {
  196. reg.lastIndex = 0;
  197. return reg.test(value);
  198. });
  199. };
  200. }
  201. var common = /*#__PURE__*/Object.freeze({
  202. __proto__: null,
  203. forEach: forEach,
  204. len: len,
  205. normalizeValidatorObject: normalizeValidatorObject,
  206. regex: regex,
  207. req: req,
  208. unwrap: vueDemi.unref,
  209. unwrapNormalizedValidator: unwrapNormalizedValidator,
  210. unwrapValidatorResponse: unwrapValidatorResponse,
  211. withAsync: withAsync,
  212. withMessage: withMessage,
  213. withParams: withParams
  214. });
  215. var alpha$1 = regex(/^[a-zA-Z]*$/);
  216. var alpha = {
  217. $validator: alpha$1,
  218. $message: 'The value is not alphabetical',
  219. $params: {
  220. type: 'alpha'
  221. }
  222. };
  223. var alphaNum$1 = regex(/^[a-zA-Z0-9]*$/);
  224. var alphaNum = {
  225. $validator: alphaNum$1,
  226. $message: 'The value must be alpha-numeric',
  227. $params: {
  228. type: 'alphaNum'
  229. }
  230. };
  231. var numeric$1 = regex(/^\d*(\.\d+)?$/);
  232. var numeric = {
  233. $validator: numeric$1,
  234. $message: 'Value must be numeric',
  235. $params: {
  236. type: 'numeric'
  237. }
  238. };
  239. function between$1 (min, max) {
  240. return value => !req(value) || (!/\s/.test(value) || value instanceof Date) && +vueDemi.unref(min) <= +value && +vueDemi.unref(max) >= +value;
  241. }
  242. function between (min, max) {
  243. return {
  244. $validator: between$1(min, max),
  245. $message: _ref => {
  246. let {
  247. $params
  248. } = _ref;
  249. return `The value must be between ${$params.min} and ${$params.max}`;
  250. },
  251. $params: {
  252. min,
  253. max,
  254. type: 'between'
  255. }
  256. };
  257. }
  258. const emailRegex = /^(?:[A-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[A-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9]{2,}(?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])$/i;
  259. var email$1 = regex(emailRegex);
  260. var email = {
  261. $validator: email$1,
  262. $message: 'Value is not a valid email address',
  263. $params: {
  264. type: 'email'
  265. }
  266. };
  267. function ipAddress$1 (value) {
  268. if (!req(value)) {
  269. return true;
  270. }
  271. if (typeof value !== 'string') {
  272. return false;
  273. }
  274. const nibbles = value.split('.');
  275. return nibbles.length === 4 && nibbles.every(nibbleValid);
  276. }
  277. const nibbleValid = nibble => {
  278. if (nibble.length > 3 || nibble.length === 0) {
  279. return false;
  280. }
  281. if (nibble[0] === '0' && nibble !== '0') {
  282. return false;
  283. }
  284. if (!nibble.match(/^\d+$/)) {
  285. return false;
  286. }
  287. const numeric = +nibble | 0;
  288. return numeric >= 0 && numeric <= 255;
  289. };
  290. var ipAddress = {
  291. $validator: ipAddress$1,
  292. $message: 'The value is not a valid IP address',
  293. $params: {
  294. type: 'ipAddress'
  295. }
  296. };
  297. function macAddress$1 () {
  298. let separator = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ':';
  299. return value => {
  300. separator = vueDemi.unref(separator);
  301. if (!req(value)) {
  302. return true;
  303. }
  304. if (typeof value !== 'string') {
  305. return false;
  306. }
  307. const parts = typeof separator === 'string' && separator !== '' ? value.split(separator) : value.length === 12 || value.length === 16 ? value.match(/.{2}/g) : null;
  308. return parts !== null && (parts.length === 6 || parts.length === 8) && parts.every(hexValid);
  309. };
  310. }
  311. const hexValid = hex => hex.toLowerCase().match(/^[0-9a-f]{2}$/);
  312. function macAddress (separator) {
  313. return {
  314. $validator: macAddress$1(separator),
  315. $message: 'The value is not a valid MAC Address',
  316. $params: {
  317. type: 'macAddress'
  318. }
  319. };
  320. }
  321. function maxLength$1 (length) {
  322. return value => !req(value) || len(value) <= vueDemi.unref(length);
  323. }
  324. function maxLength (max) {
  325. return {
  326. $validator: maxLength$1(max),
  327. $message: _ref => {
  328. let {
  329. $params
  330. } = _ref;
  331. return `The maximum length allowed is ${$params.max}`;
  332. },
  333. $params: {
  334. max,
  335. type: 'maxLength'
  336. }
  337. };
  338. }
  339. function minLength$1 (length) {
  340. return value => !req(value) || len(value) >= vueDemi.unref(length);
  341. }
  342. function minLength (min) {
  343. return {
  344. $validator: minLength$1(min),
  345. $message: _ref => {
  346. let {
  347. $params
  348. } = _ref;
  349. return `This field should be at least ${$params.min} characters long`;
  350. },
  351. $params: {
  352. min,
  353. type: 'minLength'
  354. }
  355. };
  356. }
  357. function required$1 (value) {
  358. if (typeof value === 'string') {
  359. value = value.trim();
  360. }
  361. return req(value);
  362. }
  363. var required = {
  364. $validator: required$1,
  365. $message: 'Value is required',
  366. $params: {
  367. type: 'required'
  368. }
  369. };
  370. const validate$1 = (prop, val) => prop ? req(typeof val === 'string' ? val.trim() : val) : true;
  371. function requiredIf$1(propOrFunction) {
  372. return function (value, parentVM) {
  373. if (typeof propOrFunction !== 'function') {
  374. return validate$1(vueDemi.unref(propOrFunction), value);
  375. }
  376. const result = propOrFunction.call(this, value, parentVM);
  377. return validate$1(result, value);
  378. };
  379. }
  380. function requiredIf (prop) {
  381. return {
  382. $validator: requiredIf$1(prop),
  383. $message: 'The value is required',
  384. $params: {
  385. type: 'requiredIf',
  386. prop
  387. }
  388. };
  389. }
  390. const validate = (prop, val) => !prop ? req(typeof val === 'string' ? val.trim() : val) : true;
  391. function requiredUnless$1(propOrFunction) {
  392. return function (value, parentVM) {
  393. if (typeof propOrFunction !== 'function') {
  394. return validate(vueDemi.unref(propOrFunction), value);
  395. }
  396. const result = propOrFunction.call(this, value, parentVM);
  397. return validate(result, value);
  398. };
  399. }
  400. function requiredUnless (prop) {
  401. return {
  402. $validator: requiredUnless$1(prop),
  403. $message: 'The value is required',
  404. $params: {
  405. type: 'requiredUnless',
  406. prop
  407. }
  408. };
  409. }
  410. function sameAs$1 (equalTo) {
  411. return value => vueDemi.unref(value) === vueDemi.unref(equalTo);
  412. }
  413. function sameAs (equalTo) {
  414. let otherName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'other';
  415. return {
  416. $validator: sameAs$1(equalTo),
  417. $message: _ref => {
  418. return `The value must be equal to the ${otherName} value`;
  419. },
  420. $params: {
  421. equalTo,
  422. otherName,
  423. type: 'sameAs'
  424. }
  425. };
  426. }
  427. const urlRegex = /^(?:(?:(?:https?|ftp):)?\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u00a1-\uffff][a-z0-9\u00a1-\uffff_-]{0,62})?[a-z0-9\u00a1-\uffff]\.)+(?:[a-z\u00a1-\uffff]{2,}\.?))(?::\d{2,5})?(?:[/?#]\S*)?$/i;
  428. var url$1 = regex(urlRegex);
  429. var url = {
  430. $validator: url$1,
  431. $message: 'The value is not a valid URL address',
  432. $params: {
  433. type: 'url'
  434. }
  435. };
  436. function syncOr(validators) {
  437. return function () {
  438. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  439. args[_key] = arguments[_key];
  440. }
  441. return validators.reduce((valid, fn) => {
  442. if (unwrapValidatorResponse(valid)) return valid;
  443. return unwrapNormalizedValidator(fn).apply(this, args);
  444. }, false);
  445. };
  446. }
  447. function asyncOr(validators) {
  448. return function () {
  449. for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
  450. args[_key2] = arguments[_key2];
  451. }
  452. return validators.reduce(async (valid, fn) => {
  453. const r = await valid;
  454. if (unwrapValidatorResponse(r)) return r;
  455. return unwrapNormalizedValidator(fn).apply(this, args);
  456. }, Promise.resolve(false));
  457. };
  458. }
  459. function or$1() {
  460. for (var _len3 = arguments.length, validators = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
  461. validators[_key3] = arguments[_key3];
  462. }
  463. const $async = validators.some(v => v.$async);
  464. const $watchTargets = validators.reduce((all, v) => {
  465. if (!v.$watchTargets) return all;
  466. return all.concat(v.$watchTargets);
  467. }, []);
  468. let $validator = () => false;
  469. if (validators.length) $validator = $async ? asyncOr(validators) : syncOr(validators);
  470. return {
  471. $async,
  472. $validator,
  473. $watchTargets
  474. };
  475. }
  476. function or () {
  477. return withParams({
  478. type: 'or'
  479. }, withMessage('The value does not match any of the provided validators', or$1(...arguments)));
  480. }
  481. function syncAnd(validators) {
  482. return function () {
  483. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  484. args[_key] = arguments[_key];
  485. }
  486. return validators.reduce((valid, fn) => {
  487. if (!unwrapValidatorResponse(valid)) return valid;
  488. return unwrapNormalizedValidator(fn).apply(this, args);
  489. }, true);
  490. };
  491. }
  492. function asyncAnd(validators) {
  493. return function () {
  494. for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
  495. args[_key2] = arguments[_key2];
  496. }
  497. return validators.reduce(async (valid, fn) => {
  498. const r = await valid;
  499. if (!unwrapValidatorResponse(r)) return r;
  500. return unwrapNormalizedValidator(fn).apply(this, args);
  501. }, Promise.resolve(true));
  502. };
  503. }
  504. function and$1() {
  505. for (var _len3 = arguments.length, validators = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
  506. validators[_key3] = arguments[_key3];
  507. }
  508. const $async = validators.some(v => v.$async);
  509. const $watchTargets = validators.reduce((all, v) => {
  510. if (!v.$watchTargets) return all;
  511. return all.concat(v.$watchTargets);
  512. }, []);
  513. let $validator = () => false;
  514. if (validators.length) $validator = $async ? asyncAnd(validators) : syncAnd(validators);
  515. return {
  516. $async,
  517. $validator,
  518. $watchTargets
  519. };
  520. }
  521. function and () {
  522. return withParams({
  523. type: 'and'
  524. }, withMessage('The value does not match all of the provided validators', and$1(...arguments)));
  525. }
  526. function not$1 (validator) {
  527. return function (value, vm) {
  528. if (!req(value)) return true;
  529. const response = unwrapNormalizedValidator(validator).call(this, value, vm);
  530. if (!isPromise(response)) return !unwrapValidatorResponse(response);
  531. return response.then(r => !unwrapValidatorResponse(r));
  532. };
  533. }
  534. function not (validator) {
  535. return {
  536. $validator: not$1(validator),
  537. $message: `The value does not match the provided validator`,
  538. $params: {
  539. type: 'not'
  540. }
  541. };
  542. }
  543. function minValue$1 (min) {
  544. return value => !req(value) || (!/\s/.test(value) || value instanceof Date) && +value >= +vueDemi.unref(min);
  545. }
  546. function minValue (min) {
  547. return {
  548. $validator: minValue$1(min),
  549. $message: _ref => {
  550. let {
  551. $params
  552. } = _ref;
  553. return `The minimum value allowed is ${$params.min}`;
  554. },
  555. $params: {
  556. min,
  557. type: 'minValue'
  558. }
  559. };
  560. }
  561. function maxValue$1 (max) {
  562. return value => !req(value) || (!/\s/.test(value) || value instanceof Date) && +value <= +vueDemi.unref(max);
  563. }
  564. var maxValue = (max => ({
  565. $validator: maxValue$1(max),
  566. $message: _ref => {
  567. let {
  568. $params
  569. } = _ref;
  570. return `The maximum value allowed is ${$params.max}`;
  571. },
  572. $params: {
  573. max,
  574. type: 'maxValue'
  575. }
  576. }));
  577. var integer$1 = regex(/(^[0-9]*$)|(^-[0-9]+$)/);
  578. var integer = {
  579. $validator: integer$1,
  580. $message: 'Value is not an integer',
  581. $params: {
  582. type: 'integer'
  583. }
  584. };
  585. var decimal$1 = regex(/^[-]?\d*(\.\d+)?$/);
  586. var decimal = {
  587. $validator: decimal$1,
  588. $message: 'Value must be decimal',
  589. $params: {
  590. type: 'decimal'
  591. }
  592. };
  593. function createI18nMessage(_ref) {
  594. let {
  595. t,
  596. messagePath = _ref2 => {
  597. let {
  598. $validator
  599. } = _ref2;
  600. return `validations.${$validator}`;
  601. },
  602. messageParams = params => params
  603. } = _ref;
  604. return function withI18nMessage(validator) {
  605. let {
  606. withArguments = false,
  607. messagePath: localMessagePath = messagePath,
  608. messageParams: localMessageParams = messageParams
  609. } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  610. function message(props) {
  611. return t(localMessagePath(props), localMessageParams(_objectSpread2({
  612. model: props.$model,
  613. property: props.$property,
  614. pending: props.$pending,
  615. invalid: props.$invalid,
  616. response: props.$response,
  617. validator: props.$validator,
  618. propertyPath: props.$propertyPath
  619. }, props.$params)));
  620. }
  621. if (withArguments && typeof validator === 'function') {
  622. return function () {
  623. return withMessage(message, validator(...arguments));
  624. };
  625. }
  626. return withMessage(message, validator);
  627. };
  628. }
  629. exports.alpha = alpha;
  630. exports.alphaNum = alphaNum;
  631. exports.and = and;
  632. exports.between = between;
  633. exports.createI18nMessage = createI18nMessage;
  634. exports.decimal = decimal;
  635. exports.email = email;
  636. exports.helpers = common;
  637. exports.integer = integer;
  638. exports.ipAddress = ipAddress;
  639. exports.macAddress = macAddress;
  640. exports.maxLength = maxLength;
  641. exports.maxValue = maxValue;
  642. exports.minLength = minLength;
  643. exports.minValue = minValue;
  644. exports.not = not;
  645. exports.numeric = numeric;
  646. exports.or = or;
  647. exports.required = required;
  648. exports.requiredIf = requiredIf;
  649. exports.requiredUnless = requiredUnless;
  650. exports.sameAs = sameAs;
  651. exports.url = url;