Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vee-validate

Package Overview
Dependencies
Maintainers
1
Versions
343
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vee-validate - npm Package Compare versions

Comparing version 2.0.0-beta.1 to 2.0.0-beta.2

20

dist/vee-validate.js

@@ -814,5 +814,7 @@ (function webpackUniversalModuleDefinition(root, factory) {

context.$validator.attach(binding.expression || el.name, el.dataset.rules, el.dataset.as);
attachValidatorEvent(el, binding, { context: context });
if (binding.expression) {
attachValidatorEvent(el, binding, { context: context });
if (binding.expression && !binding.modifiers.initial) {
// if its bound, validate it. (since update doesn't trigger after bind).
context.$validator.validate(binding.expression, binding.value);

@@ -827,9 +829,2 @@ return;

el.addEventListener(el.type === 'file' ? 'change' : 'input', handler);
attachValidatorEvent(el, binding, { context: context });
// if its bound, validate it (ensures consistant behavior with v1.x and inital modifier).
if (binding.expression) {
context.$validator.validate(binding.expression, binding.value);
}
},

@@ -847,9 +842,2 @@ update: function update(el, _ref8, _ref9) {

if (modifiers.initial && !el.dataset.initial) {
// eslint-disable-next-line
el.dataset.initial = 'updated';
return;
}
context.$validator.validate(expression || el.name, value);

@@ -856,0 +844,0 @@ }

2

dist/vee-validate.min.js

@@ -1,1 +0,1 @@

!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.VeeValidate=e():t.VeeValidate=e()}(this,function(){return function(t){function e(n){if(r[n])return r[n].exports;var i=r[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var r={};return e.m=t,e.c=r,e.i=function(t){return t},e.d=function(t,e,r){Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:r})},e.n=function(t){var r=t&&t.__esModule?function(){return t["default"]}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=32)}([function(t,e,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol?"symbol":typeof t},a=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),o=function(){function t(){n(this,t),this.errors=[]}return a(t,[{key:"add",value:function(t,e){this.errors.push({field:t,msg:e})}},{key:"all",value:function(){return this.errors.map(function(t){return t.msg})}},{key:"any",value:function(){return!!this.errors.length}},{key:"clear",value:function(){this.errors=[]}},{key:"collect",value:function(t){var e=this;if(!t){var r=function(){var t={};return e.errors.forEach(function(e){t[e.field]||(t[e.field]=[]),t[e.field].push(e.msg)}),{v:t}}();if("object"===("undefined"==typeof r?"undefined":i(r)))return r.v}return this.errors.filter(function(e){return e.field===t}).map(function(t){return t.msg})}},{key:"count",value:function(){return this.errors.length}},{key:"first",value:function(t){for(var e=0;e<this.errors.length;e++)if(this.errors[e].field===t)return this.errors[e].msg;return null}},{key:"has",value:function(t){for(var e=0;e<this.errors.length;e++)if(this.errors[e].field===t)return!0;return!1}},{key:"remove",value:function(t){this.errors=this.errors.filter(function(e){return e.field!==t})}}]),t}();e.a=o},function(t,e,r){"use strict";var n=r(2);r.d(e,"b",function(){return o}),r.d(e,"a",function(){return u});var i=[],a=function(t){for(var e=0;e<i.length;e++)if(i[e].$vm===t)return i[e].$validator},o=function(t){var e=a(t);return e||(e=n.a.create(void 0,t),i.push({$vm:t,$validator:e})),e},u=function(t){for(var e=0;e<i.length;e++)if(i[e].$vm===t)return i.splice(e,1),!0;return!1}},function(t,e,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var i=r(19),a=r(0),o=r(5),u=r(7),c=r(31),s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol?"symbol":typeof t},f=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),l="veeValidate",v="en",d=function(){function t(e,r){n(this,t),this.locale=v,this.$fields=this._normalize(e),this.errorBag=new a.a,this.$vm=r}return f(t,[{key:"setLocale",value:function(t){u.a[t]||r.i(c.a)("You are setting the validator locale to a locale that is not defined in the dicitionary. English messages may still be generated."),this.locale=t}},{key:"attach",value:function(t,e){var r=this,n=arguments.length<=2||void 0===arguments[2]?null:arguments[2];this.$fields[t]||(this.$fields[t]={}),this.$fields[t].validations=[],this.errorBag.remove(t),e.split("|").forEach(function(e){r.$fields[t].validations.push(r._normalizeRule(e))}),n&&(this.$fields[t].name=n)}},{key:"updateDictionary",value:function(e){t.updateDictionary(e)}},{key:"detach",value:function(t){delete this.$fields[t]}},{key:"extend",value:function(e,r){t.extend(e,r)}},{key:"validateAll",value:function(t){var e=this;if(this.errorBag.clear(),this.$vm&&!this.values)return void this.$vm.$emit(l);var r=!0;return Object.keys(t).forEach(function(n){r=e.validate(n,t[n])}),r}},{key:"validate",value:function(t,e){var n=this;if(!this.$fields[t])return r.i(c.a)('You are trying to validate a non-existant field. Use "attach()" first.'),!1;var i=!0;return this.errorBag.remove(t),this.$fields[t].validations.forEach(function(r){i=n._test(t,e,r)}),i}},{key:"_normalize",value:function(t){var e=this;if(!t)return{};var r={};return Object.keys(t).forEach(function(n){t[n].split("|").forEach(function(t){r[n]||(r[n]={validations:[]}),r[n].validations.push(e._normalizeRule(t))})}),r}},{key:"_normalizeRule",value:function(t){var e=null;return~t.indexOf(":")&&(e=t.split(":")[1].split(",")),{name:t.split(":")[0],params:e}}},{key:"_formatErrorMessage",value:function(t,e){return u.a[this.locale]&&"function"==typeof u.a[this.locale][e.name]?u.a[this.locale][e.name](t,e.params):u.a.en[e.name](t,e.params)}},{key:"_test",value:function(t,e,r){var n=this,a=i.a[r.name],o=a(e,r.params),u=this.$fields[t].name||t;return o instanceof Promise?o.then(function(e){var i=e.reduce(function(t,e){return t&&e.valid},!0);return i||n.errorBag.add(t,n._formatErrorMessage(u,r)),i}):(o||this.errorBag.add(t,this._formatErrorMessage(u,r)),o)}},{key:"getErrors",value:function(){return this.errorBag}}],[{key:"setDefaultLocale",value:function(){var t=arguments.length<=0||void 0===arguments[0]?"en":arguments[0];u.a[t]||r.i(c.a)("You are setting the validator locale to a locale that is not defined in the dicitionary. English messages may still be generated."),v=t}},{key:"updateDictionary",value:function(t){Object.keys(t).forEach(function(e){u.a[e]||(u.a[e]={}),Object.keys(t[e]).forEach(function(r){u.a[e][r]=t[e][r]})})}},{key:"create",value:function(e,r){return new t(e,r)}},{key:"extend",value:function(e,r){t._guardExtend(e,r),t._merge(e,r)}},{key:"_merge",value:function(t,e){return"function"==typeof e?(i.a[t]=e,void(u.a.en[t]=function(t){return"The "+t+" value is not valid."})):(i.a[t]=e.validate,e.getMessage&&"function"==typeof e.getMessage&&(u.a.en[t]=e.getMessage),void(e.messages&&Object.keys(e.messages).forEach(function(r){u.a[r]||(u.a[r]={}),u.a[r][t]=e.messages[r]})))}},{key:"_guardExtend",value:function(t,e){if(i.a[t])throw new o.a("Extension Error: There is an existing validator with the same name '"+t+"'.");if("function"!=typeof e){if("function"!=typeof e.validate)throw new o.a("Extension Error: The validator '"+t+"' must be a function or have a 'validate' method.");if("function"!=typeof e.getMessage&&"object"!==s(e.messages))throw new o.a("Extension Error: The validator '"+t+"' must have a 'getMessage' method or have a 'messages' object.")}}}]),t}();e.a=d},function(t,e,r){"use strict";var n=r(30),i="veeValidate",a=function(t,e,r){var n=e.expression,i=r.context;return function(){i.$validator.validate(n||t.name,t.value)}},o=function(t,e,r){var n=e.modifiers,i=e.expression,a=r.context;return function(){!a.$validator.validate(i||t.name,t.files)&&n.reject&&(t.value="")}},u=function(t,e,r){var n=e.expression,o=e.value,u=r.context,c=void 0;c=n?a(t,{expression:n},{context:u}):function(){return u.$validator.validate(n||t.name,o)},u.$on(i,c)};e.a=function(t){return{bind:function(e,i,c){var s=c.context;if(s.$validator.attach(i.expression||e.name,e.dataset.rules,e.dataset.as),i.expression)return void u(e,i,{context:s});var f="file"===e.type?o(e,i,{context:s}):a(e,{},{context:s}),l=e.dataset.delay||t.delay;f=l?r.i(n.a)(f,l):f,e.addEventListener("file"===e.type?"change":"input",f),u(e,i,{context:s}),i.expression&&s.$validator.validate(i.expression,i.value)},update:function(t,e,r){var n=e.expression,i=e.value,a=e.modifiers,o=e.oldValue,u=r.context;if(n&&i!==o)return a.initial&&!t.dataset.initial?void(t.dataset.initial="updated"):void u.$validator.validate(n||t.name,i)}}}},function(t,e,r){"use strict";function n(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var i=r(1);e.a=function(t){return{data:function(){return n({},t.errorBagName,this.$validator.errorBag)},destroyed:function(){r.i(i.a)(this)}}}},function(t,e,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var i=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),a=function(){function t(e){n(this,t),this.msg=e}return i(t,[{key:"toString",value:function(){return this.msg}}]),t}();e.a=a},function(t,e,r){"use strict";var n=function(){function t(t,e){var r=[],n=!0,i=!1,a=void 0;try{for(var o,u=t[Symbol.iterator]();!(n=(o=u.next()).done)&&(r.push(o.value),!e||r.length!==e);n=!0);}catch(c){i=!0,a=c}finally{try{!n&&u["return"]&&u["return"]()}finally{if(i)throw a}}return r}return function(e,r){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();e.a={alpha_dash:function(t){return"The "+t+" may contain alpha-numeric characters as well as dashes and underscores."},alpha_num:function(t){return"The "+t+" may only contain alpha-numeric characters and."},alpha:function(t){return"The "+t+" may only contain alphabetic characters."},between:function(t,e){var r=n(e,2),i=r[0],a=r[1];return"The "+t+" must be between "+i+" and "+a+"."},confirmed:function(t,e){var r=n(e,1),i=r[0];return"The "+t+" does not match the "+i+"."},digits:function(t,e){var r=n(e,1),i=r[0];return"The "+t+" must be numeric and exactly contain "+i+" digits."},dimensions:function(t,e){var r=n(e,2),i=r[0],a=r[1];return"The "+t+" must be "+i+" pixels by "+a+" pixels."},email:function(t){return"The "+t+" must be a valid email."},ext:function(t){return"The "+t+" must be a valid file."},image:function(t){return"The "+t+" must be an image."},"in":function(t){return"The "+t+" must be a valid value."},ip:function(t){return"The "+t+" must be a valid ip address."},max:function(t,e){var r=n(e,1),i=r[0];return"The "+t+" may not be greater than "+i+" characters."},mimes:function(t){return"The "+t+" must have a valid file type."},min:function(t,e){var r=n(e,1),i=r[0];return"The "+t+" must be at least "+i+" characters."},not_in:function(t){return"The "+t+" must be a valid value."},numeric:function(t){return"The "+t+" may only contain numeric characters."},regex:function(t){return"The "+t+" format is invalid."},required:function(t){return"The "+t+" is required."},size:function(t,e){var r=n(e,1),i=r[0];return"The "+t+" must be less than "+i+" KB."},url:function(t){return"The "+t+" is not a valid URL."}}},function(t,e,r){"use strict";var n=r(6);e.a={en:n.a}},function(t,e,r){"use strict";e.a=function(t){return!Array.isArray(t)&&/^[a-zA-Z]*$/.test(t)}},function(t,e,r){"use strict";e.a=function(t){return!Array.isArray(t)&&/^[a-zA-Z0-9_-]*$/.test(t)}},function(t,e,r){"use strict";e.a=function(t){return!Array.isArray(t)&&/^[a-zA-Z0-9]*$/.test(t)}},function(t,e,r){"use strict";var n=function(){function t(t,e){var r=[],n=!0,i=!1,a=void 0;try{for(var o,u=t[Symbol.iterator]();!(n=(o=u.next()).done)&&(r.push(o.value),!e||r.length!==e);n=!0);}catch(c){i=!0,a=c}finally{try{!n&&u["return"]&&u["return"]()}finally{if(i)throw a}}return r}return function(e,r){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();e.a=function(t,e){var r=n(e,2),i=r[0],a=r[1];return Number(i)<=t&&Number(a)>=t}},function(t,e,r){"use strict";var n=function(){function t(t,e){var r=[],n=!0,i=!1,a=void 0;try{for(var o,u=t[Symbol.iterator]();!(n=(o=u.next()).done)&&(r.push(o.value),!e||r.length!==e);n=!0);}catch(c){i=!0,a=c}finally{try{!n&&u["return"]&&u["return"]()}finally{if(i)throw a}}return r}return function(e,r){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();e.a=function(t,e){var r=n(e,1),i=r[0],a=document.querySelector("input[name='"+i+"']");return!(!a||String(t)!==a.value)}},function(t,e,r){"use strict";var n=function(){function t(t,e){var r=[],n=!0,i=!1,a=void 0;try{for(var o,u=t[Symbol.iterator]();!(n=(o=u.next()).done)&&(r.push(o.value),!e||r.length!==e);n=!0);}catch(c){i=!0,a=c}finally{try{!n&&u["return"]&&u["return"]()}finally{if(i)throw a}}return r}return function(e,r){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();e.a=function(t,e){var r=n(e,1),i=r[0],a=String(t);return/^[0-9]*$/.test(a)&&a.length===Number(i)}},function(t,e,r){"use strict";var n=function(){function t(t,e){var r=[],n=!0,i=!1,a=void 0;try{for(var o,u=t[Symbol.iterator]();!(n=(o=u.next()).done)&&(r.push(o.value),!e||r.length!==e);n=!0);}catch(c){i=!0,a=c}finally{try{!n&&u["return"]&&u["return"]()}finally{if(i)throw a}}return r}return function(e,r){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),i=function(t,e,r){var n=window.URL||window.webkitURL;return new Promise(function(i){var a=new Image;a.onerror=function(){return i({name:t.name,valid:!1})},a.onload=function(){var n=a.width===Number(e)&&a.height===Number(r);i({name:t.name,valid:n})},a.src=n.createObjectURL(t)})};e.a=function(t,e){for(var r=n(e,2),a=r[0],o=r[1],u=[],c=0;c<t.length;c++){if(!/\.(jpg|svg|jpeg|png|bmp|gif)$/i.test(t[c].name))return!1;u.push(t[c])}return Promise.all(u.map(function(t){return i(t,a,o)}))}},function(t,e,r){"use strict";e.a=function(t){return/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6}$/.test(t)}},function(t,e,r){"use strict";e.a=function(t,e){for(var r=new RegExp(".("+e.join("|")+")$","i"),n=0;n<t.length;n++)if(!r.test(t[n].name))return!1;return!0}},function(t,e,r){"use strict";e.a=function(t){for(var e=0;e<t.length;e++)if(!/\.(jpg|svg|jpeg|png|bmp|gif)$/i.test(t[e].name))return!1;return!0}},function(t,e,r){"use strict";e.a=function(t,e){return!!e.filter(function(e){return e==t}).length}},function(t,e,r){"use strict";var n=r(15),i=r(18),a=r(27),o=r(23),u=r(21),c=r(24),s=r(8),f=r(10),l=r(9),v=r(25),d=r(26),h=r(20),y=r(16),m=r(22),p=r(28),g=r(13),b=r(17),w=r(14),x=r(11),A=r(12),$=r(29);e.a={email:n.a,min:o.a,max:u.a,required:a.a,"in":i.a,not_in:c.a,alpha:s.a,alpha_num:f.a,alpha_dash:l.a,numeric:v.a,regex:d.a,ip:h.a,ext:y.a,mimes:m.a,size:p.a,digits:g.a,image:b.a,dimensions:w.a,between:x.a,confirmed:A.a,url:$.a}},function(t,e,r){"use strict";e.a=function(t){return/^(?:(?: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]?)$/.test(t)}},function(t,e,r){"use strict";var n=function(){function t(t,e){var r=[],n=!0,i=!1,a=void 0;try{for(var o,u=t[Symbol.iterator]();!(n=(o=u.next()).done)&&(r.push(o.value),!e||r.length!==e);n=!0);}catch(c){i=!0,a=c}finally{try{!n&&u["return"]&&u["return"]()}finally{if(i)throw a}}return r}return function(e,r){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();e.a=function(t,e){var r=n(e,1),i=r[0];return void 0===t||null===t?i>=0:String(t).length<=i}},function(t,e,r){"use strict";e.a=function(t,e){for(var r=new RegExp(e.join("|").replace("*",".+")+"$","i"),n=0;n<t.length;n++)if(!r.test(t[n].type))return!1;return!0}},function(t,e,r){"use strict";var n=function(){function t(t,e){var r=[],n=!0,i=!1,a=void 0;try{for(var o,u=t[Symbol.iterator]();!(n=(o=u.next()).done)&&(r.push(o.value),!e||r.length!==e);n=!0);}catch(c){i=!0,a=c}finally{try{!n&&u["return"]&&u["return"]()}finally{if(i)throw a}}return r}return function(e,r){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();e.a=function(t,e){var r=n(e,1),i=r[0];return void 0!==t&&null!==t&&String(t).length>=i}},function(t,e,r){"use strict";e.a=function(t,e){return!e.filter(function(e){return e==t}).length}},function(t,e,r){"use strict";e.a=function(t){return!Array.isArray(t)&&/^[0-9]*$/.test(t)}},function(t,e,r){"use strict";function n(t){return Array.isArray(t)?t:Array.from(t)}e.a=function(t,e){var r=n(e),i=r[0],a=r.slice(1);return new RegExp(i,a).test(String(t))}},function(t,e,r){"use strict";e.a=function(t){return Array.isArray(t)?!!t.length:void 0!==t&&null!==t&&!!String(t).length}},function(t,e,r){"use strict";var n=function(){function t(t,e){var r=[],n=!0,i=!1,a=void 0;try{for(var o,u=t[Symbol.iterator]();!(n=(o=u.next()).done)&&(r.push(o.value),!e||r.length!==e);n=!0);}catch(c){i=!0,a=c}finally{try{!n&&u["return"]&&u["return"]()}finally{if(i)throw a}}return r}return function(e,r){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();e.a=function(t,e){var r=n(e,1),i=r[0];if(isNaN(i))return!1;for(var a=1024*Number(i),o=0;o<t.length;o++)if(t[o].size>a)return!1;return!0}},function(t,e,r){"use strict";e.a=function(t,e){var r=/^https?:\/\/([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w\.\(\)%-]*)*\/?$/.test(t),n=e&&e[0];return n&&r?new RegExp("^https?://(([da-z.-]+).)*("+e[0].replace(".","\\$&")+")").test(t):r}},function(t,e,r){"use strict";function n(t){if(Array.isArray(t)){for(var e=0,r=Array(t.length);e<t.length;e++)r[e]=t[e];return r}return Array.from(t)}function i(t){return Array.isArray(t)?t:Array.from(t)}e.a=function(t){var e=arguments.length<=1||void 0===arguments[1]?100:arguments[1],r=!(arguments.length<=2||void 0===arguments[2])&&arguments[2],a=void 0;return function(o){function u(){r||t.apply(f,s),a=null}var c=i(o),s=c,f=this;a?clearTimeout(a):r&&t.apply.apply(t,[f].concat(n(s))),a=setTimeout(u,e||100)}}},function(t,e,r){"use strict";e.a=function(t){console&&console.warn("vee-validate: "+t)}},function(t,e,r){"use strict";var n=r(2),i=r(1),a=r(4),o=r(3),u=r(0);r.d(e,"install",function(){return c});var c=function(t){var e=arguments.length<=1||void 0===arguments[1]?{locale:"en",delay:0,errorBagName:"errors",messages:null}:arguments[1],u=e.locale,c=e.delay,s=e.errorBagName,f=e.messages;f&&n.a.updateDictionary(f),n.a.setDefaultLocale(u);var l={locale:u,delay:c,messages:f,errorBagName:s};Object.defineProperties(t.prototype,{$validator:{get:function(){return r.i(i.b)(this)}}}),t.mixin(r.i(a.a)(l)),t.directive("validate",r.i(o.a)(l))};r.o(n,"a")&&r.d(e,"Validator",function(){return n.a}),r.o(u,"a")&&r.d(e,"ErrorBag",function(){return u.a})}])});
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.VeeValidate=e():t.VeeValidate=e()}(this,function(){return function(t){function e(n){if(r[n])return r[n].exports;var a=r[n]={i:n,l:!1,exports:{}};return t[n].call(a.exports,a,a.exports,e),a.l=!0,a.exports}var r={};return e.m=t,e.c=r,e.i=function(t){return t},e.d=function(t,e,r){Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:r})},e.n=function(t){var r=t&&t.__esModule?function(){return t["default"]}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=32)}([function(t,e,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol?"symbol":typeof t},i=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),o=function(){function t(){n(this,t),this.errors=[]}return i(t,[{key:"add",value:function(t,e){this.errors.push({field:t,msg:e})}},{key:"all",value:function(){return this.errors.map(function(t){return t.msg})}},{key:"any",value:function(){return!!this.errors.length}},{key:"clear",value:function(){this.errors=[]}},{key:"collect",value:function(t){var e=this;if(!t){var r=function(){var t={};return e.errors.forEach(function(e){t[e.field]||(t[e.field]=[]),t[e.field].push(e.msg)}),{v:t}}();if("object"===("undefined"==typeof r?"undefined":a(r)))return r.v}return this.errors.filter(function(e){return e.field===t}).map(function(t){return t.msg})}},{key:"count",value:function(){return this.errors.length}},{key:"first",value:function(t){for(var e=0;e<this.errors.length;e++)if(this.errors[e].field===t)return this.errors[e].msg;return null}},{key:"has",value:function(t){for(var e=0;e<this.errors.length;e++)if(this.errors[e].field===t)return!0;return!1}},{key:"remove",value:function(t){this.errors=this.errors.filter(function(e){return e.field!==t})}}]),t}();e.a=o},function(t,e,r){"use strict";var n=r(2);r.d(e,"b",function(){return o}),r.d(e,"a",function(){return u});var a=[],i=function(t){for(var e=0;e<a.length;e++)if(a[e].$vm===t)return a[e].$validator},o=function(t){var e=i(t);return e||(e=n.a.create(void 0,t),a.push({$vm:t,$validator:e})),e},u=function(t){for(var e=0;e<a.length;e++)if(a[e].$vm===t)return a.splice(e,1),!0;return!1}},function(t,e,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var a=r(19),i=r(0),o=r(5),u=r(7),c=r(31),s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol?"symbol":typeof t},f=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),l="veeValidate",v="en",d=function(){function t(e,r){n(this,t),this.locale=v,this.$fields=this._normalize(e),this.errorBag=new i.a,this.$vm=r}return f(t,[{key:"setLocale",value:function(t){u.a[t]||r.i(c.a)("You are setting the validator locale to a locale that is not defined in the dicitionary. English messages may still be generated."),this.locale=t}},{key:"attach",value:function(t,e){var r=this,n=arguments.length<=2||void 0===arguments[2]?null:arguments[2];this.$fields[t]||(this.$fields[t]={}),this.$fields[t].validations=[],this.errorBag.remove(t),e.split("|").forEach(function(e){r.$fields[t].validations.push(r._normalizeRule(e))}),n&&(this.$fields[t].name=n)}},{key:"updateDictionary",value:function(e){t.updateDictionary(e)}},{key:"detach",value:function(t){delete this.$fields[t]}},{key:"extend",value:function(e,r){t.extend(e,r)}},{key:"validateAll",value:function(t){var e=this;if(this.errorBag.clear(),this.$vm&&!this.values)return void this.$vm.$emit(l);var r=!0;return Object.keys(t).forEach(function(n){r=e.validate(n,t[n])}),r}},{key:"validate",value:function(t,e){var n=this;if(!this.$fields[t])return r.i(c.a)('You are trying to validate a non-existant field. Use "attach()" first.'),!1;var a=!0;return this.errorBag.remove(t),this.$fields[t].validations.forEach(function(r){a=n._test(t,e,r)}),a}},{key:"_normalize",value:function(t){var e=this;if(!t)return{};var r={};return Object.keys(t).forEach(function(n){t[n].split("|").forEach(function(t){r[n]||(r[n]={validations:[]}),r[n].validations.push(e._normalizeRule(t))})}),r}},{key:"_normalizeRule",value:function(t){var e=null;return~t.indexOf(":")&&(e=t.split(":")[1].split(",")),{name:t.split(":")[0],params:e}}},{key:"_formatErrorMessage",value:function(t,e){return u.a[this.locale]&&"function"==typeof u.a[this.locale][e.name]?u.a[this.locale][e.name](t,e.params):u.a.en[e.name](t,e.params)}},{key:"_test",value:function(t,e,r){var n=this,i=a.a[r.name],o=i(e,r.params),u=this.$fields[t].name||t;return o instanceof Promise?o.then(function(e){var a=e.reduce(function(t,e){return t&&e.valid},!0);return a||n.errorBag.add(t,n._formatErrorMessage(u,r)),a}):(o||this.errorBag.add(t,this._formatErrorMessage(u,r)),o)}},{key:"getErrors",value:function(){return this.errorBag}}],[{key:"setDefaultLocale",value:function(){var t=arguments.length<=0||void 0===arguments[0]?"en":arguments[0];u.a[t]||r.i(c.a)("You are setting the validator locale to a locale that is not defined in the dicitionary. English messages may still be generated."),v=t}},{key:"updateDictionary",value:function(t){Object.keys(t).forEach(function(e){u.a[e]||(u.a[e]={}),Object.keys(t[e]).forEach(function(r){u.a[e][r]=t[e][r]})})}},{key:"create",value:function(e,r){return new t(e,r)}},{key:"extend",value:function(e,r){t._guardExtend(e,r),t._merge(e,r)}},{key:"_merge",value:function(t,e){return"function"==typeof e?(a.a[t]=e,void(u.a.en[t]=function(t){return"The "+t+" value is not valid."})):(a.a[t]=e.validate,e.getMessage&&"function"==typeof e.getMessage&&(u.a.en[t]=e.getMessage),void(e.messages&&Object.keys(e.messages).forEach(function(r){u.a[r]||(u.a[r]={}),u.a[r][t]=e.messages[r]})))}},{key:"_guardExtend",value:function(t,e){if(a.a[t])throw new o.a("Extension Error: There is an existing validator with the same name '"+t+"'.");if("function"!=typeof e){if("function"!=typeof e.validate)throw new o.a("Extension Error: The validator '"+t+"' must be a function or have a 'validate' method.");if("function"!=typeof e.getMessage&&"object"!==s(e.messages))throw new o.a("Extension Error: The validator '"+t+"' must have a 'getMessage' method or have a 'messages' object.")}}}]),t}();e.a=d},function(t,e,r){"use strict";var n=r(30),a="veeValidate",i=function(t,e,r){var n=e.expression,a=r.context;return function(){a.$validator.validate(n||t.name,t.value)}},o=function(t,e,r){var n=e.modifiers,a=e.expression,i=r.context;return function(){!i.$validator.validate(a||t.name,t.files)&&n.reject&&(t.value="")}},u=function(t,e,r){var n=e.expression,o=e.value,u=r.context,c=void 0;c=n?i(t,{expression:n},{context:u}):function(){return u.$validator.validate(n||t.name,o)},u.$on(a,c)};e.a=function(t){return{bind:function(e,a,c){var s=c.context;if(s.$validator.attach(a.expression||e.name,e.dataset.rules,e.dataset.as),u(e,a,{context:s}),a.expression&&!a.modifiers.initial)return void s.$validator.validate(a.expression,a.value);var f="file"===e.type?o(e,a,{context:s}):i(e,{},{context:s}),l=e.dataset.delay||t.delay;f=l?r.i(n.a)(f,l):f,e.addEventListener("file"===e.type?"change":"input",f)},update:function(t,e,r){var n=e.expression,a=e.value,i=(e.modifiers,e.oldValue),o=r.context;n&&a!==i&&o.$validator.validate(n||t.name,a)}}}},function(t,e,r){"use strict";function n(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var a=r(1);e.a=function(t){return{data:function(){return n({},t.errorBagName,this.$validator.errorBag)},destroyed:function(){r.i(a.a)(this)}}}},function(t,e,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var a=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),i=function(){function t(e){n(this,t),this.msg=e}return a(t,[{key:"toString",value:function(){return this.msg}}]),t}();e.a=i},function(t,e,r){"use strict";var n=function(){function t(t,e){var r=[],n=!0,a=!1,i=void 0;try{for(var o,u=t[Symbol.iterator]();!(n=(o=u.next()).done)&&(r.push(o.value),!e||r.length!==e);n=!0);}catch(c){a=!0,i=c}finally{try{!n&&u["return"]&&u["return"]()}finally{if(a)throw i}}return r}return function(e,r){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();e.a={alpha_dash:function(t){return"The "+t+" may contain alpha-numeric characters as well as dashes and underscores."},alpha_num:function(t){return"The "+t+" may only contain alpha-numeric characters and."},alpha:function(t){return"The "+t+" may only contain alphabetic characters."},between:function(t,e){var r=n(e,2),a=r[0],i=r[1];return"The "+t+" must be between "+a+" and "+i+"."},confirmed:function(t,e){var r=n(e,1),a=r[0];return"The "+t+" does not match the "+a+"."},digits:function(t,e){var r=n(e,1),a=r[0];return"The "+t+" must be numeric and exactly contain "+a+" digits."},dimensions:function(t,e){var r=n(e,2),a=r[0],i=r[1];return"The "+t+" must be "+a+" pixels by "+i+" pixels."},email:function(t){return"The "+t+" must be a valid email."},ext:function(t){return"The "+t+" must be a valid file."},image:function(t){return"The "+t+" must be an image."},"in":function(t){return"The "+t+" must be a valid value."},ip:function(t){return"The "+t+" must be a valid ip address."},max:function(t,e){var r=n(e,1),a=r[0];return"The "+t+" may not be greater than "+a+" characters."},mimes:function(t){return"The "+t+" must have a valid file type."},min:function(t,e){var r=n(e,1),a=r[0];return"The "+t+" must be at least "+a+" characters."},not_in:function(t){return"The "+t+" must be a valid value."},numeric:function(t){return"The "+t+" may only contain numeric characters."},regex:function(t){return"The "+t+" format is invalid."},required:function(t){return"The "+t+" is required."},size:function(t,e){var r=n(e,1),a=r[0];return"The "+t+" must be less than "+a+" KB."},url:function(t){return"The "+t+" is not a valid URL."}}},function(t,e,r){"use strict";var n=r(6);e.a={en:n.a}},function(t,e,r){"use strict";e.a=function(t){return!Array.isArray(t)&&/^[a-zA-Z]*$/.test(t)}},function(t,e,r){"use strict";e.a=function(t){return!Array.isArray(t)&&/^[a-zA-Z0-9_-]*$/.test(t)}},function(t,e,r){"use strict";e.a=function(t){return!Array.isArray(t)&&/^[a-zA-Z0-9]*$/.test(t)}},function(t,e,r){"use strict";var n=function(){function t(t,e){var r=[],n=!0,a=!1,i=void 0;try{for(var o,u=t[Symbol.iterator]();!(n=(o=u.next()).done)&&(r.push(o.value),!e||r.length!==e);n=!0);}catch(c){a=!0,i=c}finally{try{!n&&u["return"]&&u["return"]()}finally{if(a)throw i}}return r}return function(e,r){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();e.a=function(t,e){var r=n(e,2),a=r[0],i=r[1];return Number(a)<=t&&Number(i)>=t}},function(t,e,r){"use strict";var n=function(){function t(t,e){var r=[],n=!0,a=!1,i=void 0;try{for(var o,u=t[Symbol.iterator]();!(n=(o=u.next()).done)&&(r.push(o.value),!e||r.length!==e);n=!0);}catch(c){a=!0,i=c}finally{try{!n&&u["return"]&&u["return"]()}finally{if(a)throw i}}return r}return function(e,r){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();e.a=function(t,e){var r=n(e,1),a=r[0],i=document.querySelector("input[name='"+a+"']");return!(!i||String(t)!==i.value)}},function(t,e,r){"use strict";var n=function(){function t(t,e){var r=[],n=!0,a=!1,i=void 0;try{for(var o,u=t[Symbol.iterator]();!(n=(o=u.next()).done)&&(r.push(o.value),!e||r.length!==e);n=!0);}catch(c){a=!0,i=c}finally{try{!n&&u["return"]&&u["return"]()}finally{if(a)throw i}}return r}return function(e,r){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();e.a=function(t,e){var r=n(e,1),a=r[0],i=String(t);return/^[0-9]*$/.test(i)&&i.length===Number(a)}},function(t,e,r){"use strict";var n=function(){function t(t,e){var r=[],n=!0,a=!1,i=void 0;try{for(var o,u=t[Symbol.iterator]();!(n=(o=u.next()).done)&&(r.push(o.value),!e||r.length!==e);n=!0);}catch(c){a=!0,i=c}finally{try{!n&&u["return"]&&u["return"]()}finally{if(a)throw i}}return r}return function(e,r){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),a=function(t,e,r){var n=window.URL||window.webkitURL;return new Promise(function(a){var i=new Image;i.onerror=function(){return a({name:t.name,valid:!1})},i.onload=function(){var n=i.width===Number(e)&&i.height===Number(r);a({name:t.name,valid:n})},i.src=n.createObjectURL(t)})};e.a=function(t,e){for(var r=n(e,2),i=r[0],o=r[1],u=[],c=0;c<t.length;c++){if(!/\.(jpg|svg|jpeg|png|bmp|gif)$/i.test(t[c].name))return!1;u.push(t[c])}return Promise.all(u.map(function(t){return a(t,i,o)}))}},function(t,e,r){"use strict";e.a=function(t){return/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6}$/.test(t)}},function(t,e,r){"use strict";e.a=function(t,e){for(var r=new RegExp(".("+e.join("|")+")$","i"),n=0;n<t.length;n++)if(!r.test(t[n].name))return!1;return!0}},function(t,e,r){"use strict";e.a=function(t){for(var e=0;e<t.length;e++)if(!/\.(jpg|svg|jpeg|png|bmp|gif)$/i.test(t[e].name))return!1;return!0}},function(t,e,r){"use strict";e.a=function(t,e){return!!e.filter(function(e){return e==t}).length}},function(t,e,r){"use strict";var n=r(15),a=r(18),i=r(27),o=r(23),u=r(21),c=r(24),s=r(8),f=r(10),l=r(9),v=r(25),d=r(26),h=r(20),y=r(16),m=r(22),p=r(28),g=r(13),b=r(17),w=r(14),x=r(11),A=r(12),$=r(29);e.a={email:n.a,min:o.a,max:u.a,required:i.a,"in":a.a,not_in:c.a,alpha:s.a,alpha_num:f.a,alpha_dash:l.a,numeric:v.a,regex:d.a,ip:h.a,ext:y.a,mimes:m.a,size:p.a,digits:g.a,image:b.a,dimensions:w.a,between:x.a,confirmed:A.a,url:$.a}},function(t,e,r){"use strict";e.a=function(t){return/^(?:(?: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]?)$/.test(t)}},function(t,e,r){"use strict";var n=function(){function t(t,e){var r=[],n=!0,a=!1,i=void 0;try{for(var o,u=t[Symbol.iterator]();!(n=(o=u.next()).done)&&(r.push(o.value),!e||r.length!==e);n=!0);}catch(c){a=!0,i=c}finally{try{!n&&u["return"]&&u["return"]()}finally{if(a)throw i}}return r}return function(e,r){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();e.a=function(t,e){var r=n(e,1),a=r[0];return void 0===t||null===t?a>=0:String(t).length<=a}},function(t,e,r){"use strict";e.a=function(t,e){for(var r=new RegExp(e.join("|").replace("*",".+")+"$","i"),n=0;n<t.length;n++)if(!r.test(t[n].type))return!1;return!0}},function(t,e,r){"use strict";var n=function(){function t(t,e){var r=[],n=!0,a=!1,i=void 0;try{for(var o,u=t[Symbol.iterator]();!(n=(o=u.next()).done)&&(r.push(o.value),!e||r.length!==e);n=!0);}catch(c){a=!0,i=c}finally{try{!n&&u["return"]&&u["return"]()}finally{if(a)throw i}}return r}return function(e,r){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();e.a=function(t,e){var r=n(e,1),a=r[0];return void 0!==t&&null!==t&&String(t).length>=a}},function(t,e,r){"use strict";e.a=function(t,e){return!e.filter(function(e){return e==t}).length}},function(t,e,r){"use strict";e.a=function(t){return!Array.isArray(t)&&/^[0-9]*$/.test(t)}},function(t,e,r){"use strict";function n(t){return Array.isArray(t)?t:Array.from(t)}e.a=function(t,e){var r=n(e),a=r[0],i=r.slice(1);return new RegExp(a,i).test(String(t))}},function(t,e,r){"use strict";e.a=function(t){return Array.isArray(t)?!!t.length:void 0!==t&&null!==t&&!!String(t).length}},function(t,e,r){"use strict";var n=function(){function t(t,e){var r=[],n=!0,a=!1,i=void 0;try{for(var o,u=t[Symbol.iterator]();!(n=(o=u.next()).done)&&(r.push(o.value),!e||r.length!==e);n=!0);}catch(c){a=!0,i=c}finally{try{!n&&u["return"]&&u["return"]()}finally{if(a)throw i}}return r}return function(e,r){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();e.a=function(t,e){var r=n(e,1),a=r[0];if(isNaN(a))return!1;for(var i=1024*Number(a),o=0;o<t.length;o++)if(t[o].size>i)return!1;return!0}},function(t,e,r){"use strict";e.a=function(t,e){var r=/^https?:\/\/([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w\.\(\)%-]*)*\/?$/.test(t),n=e&&e[0];return n&&r?new RegExp("^https?://(([da-z.-]+).)*("+e[0].replace(".","\\$&")+")").test(t):r}},function(t,e,r){"use strict";function n(t){if(Array.isArray(t)){for(var e=0,r=Array(t.length);e<t.length;e++)r[e]=t[e];return r}return Array.from(t)}function a(t){return Array.isArray(t)?t:Array.from(t)}e.a=function(t){var e=arguments.length<=1||void 0===arguments[1]?100:arguments[1],r=!(arguments.length<=2||void 0===arguments[2])&&arguments[2],i=void 0;return function(o){function u(){r||t.apply(f,s),i=null}var c=a(o),s=c,f=this;i?clearTimeout(i):r&&t.apply.apply(t,[f].concat(n(s))),i=setTimeout(u,e||100)}}},function(t,e,r){"use strict";e.a=function(t){console&&console.warn("vee-validate: "+t)}},function(t,e,r){"use strict";var n=r(2),a=r(1),i=r(4),o=r(3),u=r(0);r.d(e,"install",function(){return c});var c=function(t){var e=arguments.length<=1||void 0===arguments[1]?{locale:"en",delay:0,errorBagName:"errors",messages:null}:arguments[1],u=e.locale,c=e.delay,s=e.errorBagName,f=e.messages;f&&n.a.updateDictionary(f),n.a.setDefaultLocale(u);var l={locale:u,delay:c,messages:f,errorBagName:s};Object.defineProperties(t.prototype,{$validator:{get:function(){return r.i(a.b)(this)}}}),t.mixin(r.i(i.a)(l)),t.directive("validate",r.i(o.a)(l))};r.o(n,"a")&&r.d(e,"Validator",function(){return n.a}),r.o(u,"a")&&r.d(e,"ErrorBag",function(){return u.a})}])});
{
"name": "vee-validate",
"version": "2.0.0-beta.1",
"version": "2.0.0-beta.2",
"description": "Simple VueJS input validation plugin",

@@ -5,0 +5,0 @@ "main": "dist/vee-validate.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc