New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

vue-tiny-validate

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-tiny-validate - npm Package Compare versions

Comparing version

to
0.2.4

2

dist/index.cjs.js

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

"use strict";var e=Object.defineProperty,t=Object.defineProperties,r=Object.getOwnPropertyDescriptors,o=Object.getOwnPropertySymbols,s=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable,c=(t,r,o)=>r in t?e(t,r,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[r]=o,n=(e,t)=>{for(var r in t||(t={}))s.call(t,r)&&c(e,r,t[r]);if(o)for(var r of o(t))a.call(t,r)&&c(e,r,t[r]);return e},i=(e,o)=>t(e,r(o)),u=require("vue-demi");const f=(e,t,r)=>{u.isVue2?u.Vue2.set(e,t,r):e[t]=r},l=(e,t)=>void 0!==e[t],y=e=>"[object Object]"===Object.prototype.toString.call(e),$=e=>u.isRef(e)?e.value:e,p=()=>{},d={$invalid:!1,$errors:[],$messages:[],$pending:!1},v=u.reactive({autoTest:!1,autoTouch:!1,lazy:!1,firstError:!1,touchOnTest:!1,transform:e=>e});module.exports=(e,t,r=u.reactive({}))=>{const o=u.reactive({}),s=u.reactive({}),a=u.reactive({}),c=u.computed((()=>n(n({},v),$(r)))),b=u.computed((()=>{const s=m(a,o),{transform:n}=c.value;return n?n(s,$(e),$(t),$(r)):s})),m=(e,t)=>{const r=i(n({},d),{$dirty:!1,$test:p,$reset:p,$touch:p}),o=Object.keys(e),s={$test:[],$reset:[],$touch:[]},a=Object.keys(s),c=(e,t)=>{const r=[...Object.keys(d),"$dirty"];for(const o of r)Array.isArray(e[o])?e[o]=[...e[o],...t[o]]:!e[o]&&t[o]&&(e[o]=!0);for(const o of a)s[o].push(t[o])};for(const i of o)if(y(e[i])&&!l(e[i],"$invalid")){const o=m(e[i],t[i]);r[i]=n({},o),c(r,o)}else r[i]=n({},e[i]),r[i].$dirty=t[i],c(r,r[i]);for(const n of a)r[n]=()=>{if("$test"===n)return Promise.all(s[n].map((e=>e())));s[n].forEach((e=>e()))};return r},O=(e,t,r,o,s)=>{const a=Object.keys(t);for(const $ of a)if(!y(t[$])||l(t[$],"test")||l(t[$],"name")){f(r,$,!1),f(o,$,e()[$]);const a={data:e,rules:t,dirt:r,rawData:o,entries:s};f(s,$,i(n({},d),{$reset:()=>j(a,$),$test:async()=>await h(a,$),$touch:()=>g(a,$)})),Object.setPrototypeOf(s[$],{$uw:u.watch((()=>e()[$]),(()=>{c.value.autoTest&&s[$].$test(),c.value.autoTouch&&s[$].$touch()}))})}else{f(o,$,{}),f(r,$,u.reactive({})),f(s,$,u.reactive({}));const a=[()=>e()[$],t[$],r[$],o[$],s[$]];O(...a)}},h=async(o,s)=>{const{data:a,rules:l,dirt:y,rawData:p,entries:d}=o,{lazy:v,firstError:b,touchOnTest:m}=c.value;let O=!1;const h=u.watch((()=>d[s].$pending),(e=>{e||(O=!0,h())}));if(f(y,s,m||y[s]||a()[s]!==p[s]),v&&!y[s])return;let j=[],g=[],w=l[s];if(w){Array.isArray(w)||(w=[w]);for(const o of w){const{test:c,message:n=null,name:i}=o;let u=c(a()[s],$(e),$(t),$(r));if(u instanceof Promise){d[s].$pending=!0;try{u=await u}catch(P){u=!1}O||(d[s].$pending=!1)}if(!u){const e="function"==typeof n?n(a()[s]):n;if(j=[...j,{name:i,message:e}],e&&g.push(e),b)break}}O||f(d,s,i(n({},d[s]),{$errors:j,$messages:g,$invalid:Boolean(j.length)}))}},j=(e,t)=>{const{dirt:r,entries:o}=e;f(r,t,!1),f(o,t,n(n({},o[t]),d))},g=(e,t)=>{const{dirt:r}=e;f(r,t,!0)},w=()=>{O((()=>$(e)),$(t),o,s,a)};return w(),u.watch(t,w),u.watch(r,w),{result:b}};
"use strict";var e=Object.defineProperty,t=Object.defineProperties,r=Object.getOwnPropertyDescriptors,o=Object.getOwnPropertySymbols,s=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable,c=(t,r,o)=>r in t?e(t,r,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[r]=o,n=(e,t)=>{for(var r in t||(t={}))s.call(t,r)&&c(e,r,t[r]);if(o)for(var r of o(t))a.call(t,r)&&c(e,r,t[r]);return e},i=(e,o)=>t(e,r(o)),u=require("vue-demi");const l=(e,t,r)=>{u.isVue2?u.Vue2.set(e,t,r):e[t]=r},f=(e,t)=>void 0!==e[t],y=e=>"[object Object]"===Object.prototype.toString.call(e),$=e=>u.isRef(e)?e.value:e,p=()=>{},d={$invalid:!1,$errors:[],$messages:[],$pending:!1},v=u.reactive({autoTest:!1,autoTouch:!1,lazy:!1,firstError:!1,touchOnTest:!1,transform:e=>e});module.exports=(e,t,r=u.reactive({}))=>{const o=u.reactive({}),s=u.reactive({}),a=u.reactive({}),c=u.computed((()=>n(n({},v),$(r)))),b=u.computed((()=>{const s=m(a,o),{transform:n}=c.value;return n?n(s,$(e),$(t),$(r)):s})),m=(e,t)=>{const r=i(n({},d),{$dirty:!1,$test:p,$reset:p,$touch:p}),o=Object.keys(e),s={$test:[],$reset:[],$touch:[]},a=Object.keys(s),c=(e,t)=>{const r=[...Object.keys(d),"$dirty"];for(const o of r)Array.isArray(e[o])?e[o]=[...e[o],...t[o]]:!e[o]&&t[o]&&(e[o]=!0);for(const o of a)s[o].push(t[o])};for(const u of o)if(y(e[u])&&!f(e[u],"$invalid")){const o=m(e[u],t[u]);r[u]=n({},o),c(r,o)}else r[u]=i(n({},e[u]),{$dirty:t[u]}),c(r,r[u]);for(const n of a)r[n]=()=>{const e=s[n].map((e=>e()));return"$test"===n?Promise.all(e):e};return r},O=(e,t,r,o,s)=>{const a=Object.keys(t);for(const $ of a)if(!y(t[$])||f(t[$],"test")||f(t[$],"name")){l(r,$,!1),l(o,$,e()[$]);const a={data:e,rules:t,dirt:r,rawData:o,entries:s};l(s,$,i(n({},d),{$reset:()=>j(a,$),$test:async()=>await h(a,$),$touch:()=>g(a,$)})),Object.setPrototypeOf(s[$],{$uw:u.watch((()=>e()[$]),(()=>{c.value.autoTest&&s[$].$test(),c.value.autoTouch&&s[$].$touch()}))})}else l(o,$,{}),l(r,$,u.reactive({})),l(s,$,u.reactive({})),O((()=>e()[$]),t[$],r[$],o[$],s[$])},h=async(o,s)=>{const{data:a,rules:f,dirt:y,rawData:p,entries:d}=o,{lazy:v,firstError:b,touchOnTest:m}=c.value,O=y[s]||m||a()[s]!==p[s];if(v&&!O)return;let h=!1;u.watch((()=>d[s].$pending),(e=>{e||(h=!0)}));let j=[],g=[],w=f[s];if(w){Array.isArray(w)||(w=[w]);for(const o of w){const{test:c,message:n=null,name:i}=o;let u=c(a()[s],$(e),$(t),$(r));if(u instanceof Promise){d[s].$pending=!0;try{u=await u}catch(P){u=!1}h||(d[s].$pending=!1)}if(!u){const e="function"==typeof n?n(a()[s]):n;if(j=[...j,{name:i,message:e}],e&&g.push(e),b)break}}h||(l(y,s,O),l(d,s,i(n({},d[s]),{$errors:j,$messages:g,$invalid:Boolean(j.length)})))}},j=(e,t)=>{const{dirt:r,entries:o}=e;l(r,t,!1),l(o,t,n(n({},o[t]),d))},g=(e,t)=>{const{dirt:r}=e;l(r,t,!0)},w=()=>{O((()=>$(e)),$(t),o,s,a)};return w(),u.watch(t,w),u.watch(r,w),{result:b}};

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

var t=Object.defineProperty,e=Object.defineProperties,r=Object.getOwnPropertyDescriptors,o=Object.getOwnPropertySymbols,s=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable,a=(e,r,o)=>r in e?t(e,r,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[r]=o,c=(t,e)=>{for(var r in e||(e={}))s.call(e,r)&&a(t,r,e[r]);if(o)for(var r of o(e))n.call(e,r)&&a(t,r,e[r]);return t},i=(t,o)=>e(t,r(o));import{reactive as f,isRef as l,isVue2 as u,Vue2 as y,computed as $,watch as p}from"vue-demi";const d=(t,e,r)=>{u?y.set(t,e,r):t[e]=r},b=(t,e)=>void 0!==t[e],O=t=>"[object Object]"===Object.prototype.toString.call(t),m=t=>l(t)?t.value:t,h=()=>{},j={$invalid:!1,$errors:[],$messages:[],$pending:!1},v=f({autoTest:!1,autoTouch:!1,lazy:!1,firstError:!1,touchOnTest:!1,transform:t=>t});export default(t,e,r=f({}))=>{const o=f({}),s=f({}),n=f({}),a=$((()=>c(c({},v),m(r)))),l=$((()=>{const s=u(n,o),{transform:c}=a.value;return c?c(s,m(t),m(e),m(r)):s})),u=(t,e)=>{const r=i(c({},j),{$dirty:!1,$test:h,$reset:h,$touch:h}),o=Object.keys(t),s={$test:[],$reset:[],$touch:[]},n=Object.keys(s),a=(t,e)=>{const r=[...Object.keys(j),"$dirty"];for(const o of r)Array.isArray(t[o])?t[o]=[...t[o],...e[o]]:!t[o]&&e[o]&&(t[o]=!0);for(const o of n)s[o].push(e[o])};for(const i of o)if(O(t[i])&&!b(t[i],"$invalid")){const o=u(t[i],e[i]);r[i]=c({},o),a(r,o)}else r[i]=c({},t[i]),r[i].$dirty=e[i],a(r,r[i]);for(const c of n)r[c]=()=>{if("$test"===c)return Promise.all(s[c].map((t=>t())));s[c].forEach((t=>t()))};return r},y=(t,e,r,o,s)=>{const n=Object.keys(e);for(const l of n)if(!O(e[l])||b(e[l],"test")||b(e[l],"name")){d(r,l,!1),d(o,l,t()[l]);const n={data:t,rules:e,dirt:r,rawData:o,entries:s};d(s,l,i(c({},j),{$reset:()=>w(n,l),$test:async()=>await g(n,l),$touch:()=>P(n,l)})),Object.setPrototypeOf(s[l],{$uw:p((()=>t()[l]),(()=>{a.value.autoTest&&s[l].$test(),a.value.autoTouch&&s[l].$touch()}))})}else{d(o,l,{}),d(r,l,f({})),d(s,l,f({}));const n=[()=>t()[l],e[l],r[l],o[l],s[l]];y(...n)}},g=async(o,s)=>{const{data:n,rules:f,dirt:l,rawData:u,entries:y}=o,{lazy:$,firstError:b,touchOnTest:O}=a.value;let h=!1;const j=p((()=>y[s].$pending),(t=>{t||(h=!0,j())}));if(d(l,s,O||l[s]||n()[s]!==u[s]),$&&!l[s])return;let v=[],g=[],w=f[s];if(w){Array.isArray(w)||(w=[w]);for(const o of w){const{test:a,message:c=null,name:i}=o;let f=a(n()[s],m(t),m(e),m(r));if(f instanceof Promise){y[s].$pending=!0;try{f=await f}catch(P){f=!1}h||(y[s].$pending=!1)}if(!f){const t="function"==typeof c?c(n()[s]):c;if(v=[...v,{name:i,message:t}],t&&g.push(t),b)break}}h||d(y,s,i(c({},y[s]),{$errors:v,$messages:g,$invalid:Boolean(v.length)}))}},w=(t,e)=>{const{dirt:r,entries:o}=t;d(r,e,!1),d(o,e,c(c({},o[e]),j))},P=(t,e)=>{const{dirt:r}=t;d(r,e,!0)},T=()=>{y((()=>m(t)),m(e),o,s,n)};return T(),p(e,T),p(r,T),{result:l}};
var t=Object.defineProperty,e=Object.defineProperties,r=Object.getOwnPropertyDescriptors,o=Object.getOwnPropertySymbols,s=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable,a=(e,r,o)=>r in e?t(e,r,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[r]=o,c=(t,e)=>{for(var r in e||(e={}))s.call(e,r)&&a(t,r,e[r]);if(o)for(var r of o(e))n.call(e,r)&&a(t,r,e[r]);return t},i=(t,o)=>e(t,r(o));import{reactive as l,isRef as u,isVue2 as f,Vue2 as y,computed as $,watch as p}from"vue-demi";const d=(t,e,r)=>{f?y.set(t,e,r):t[e]=r},b=(t,e)=>void 0!==t[e],O=t=>"[object Object]"===Object.prototype.toString.call(t),m=t=>u(t)?t.value:t,j=()=>{},v={$invalid:!1,$errors:[],$messages:[],$pending:!1},g=l({autoTest:!1,autoTouch:!1,lazy:!1,firstError:!1,touchOnTest:!1,transform:t=>t});export default(t,e,r=l({}))=>{const o=l({}),s=l({}),n=l({}),a=$((()=>c(c({},g),m(r)))),u=$((()=>{const s=f(n,o),{transform:c}=a.value;return c?c(s,m(t),m(e),m(r)):s})),f=(t,e)=>{const r=i(c({},v),{$dirty:!1,$test:j,$reset:j,$touch:j}),o=Object.keys(t),s={$test:[],$reset:[],$touch:[]},n=Object.keys(s),a=(t,e)=>{const r=[...Object.keys(v),"$dirty"];for(const o of r)Array.isArray(t[o])?t[o]=[...t[o],...e[o]]:!t[o]&&e[o]&&(t[o]=!0);for(const o of n)s[o].push(e[o])};for(const l of o)if(O(t[l])&&!b(t[l],"$invalid")){const o=f(t[l],e[l]);r[l]=c({},o),a(r,o)}else r[l]=i(c({},t[l]),{$dirty:e[l]}),a(r,r[l]);for(const c of n)r[c]=()=>{const t=s[c].map((t=>t()));return"$test"===c?Promise.all(t):t};return r},y=(t,e,r,o,s)=>{const n=Object.keys(e);for(const u of n)if(!O(e[u])||b(e[u],"test")||b(e[u],"name")){d(r,u,!1),d(o,u,t()[u]);const n={data:t,rules:e,dirt:r,rawData:o,entries:s};d(s,u,i(c({},v),{$reset:()=>w(n,u),$test:async()=>await h(n,u),$touch:()=>P(n,u)})),Object.setPrototypeOf(s[u],{$uw:p((()=>t()[u]),(()=>{a.value.autoTest&&s[u].$test(),a.value.autoTouch&&s[u].$touch()}))})}else d(o,u,{}),d(r,u,l({})),d(s,u,l({})),y((()=>t()[u]),e[u],r[u],o[u],s[u])},h=async(o,s)=>{const{data:n,rules:l,dirt:u,rawData:f,entries:y}=o,{lazy:$,firstError:b,touchOnTest:O}=a.value,j=u[s]||O||n()[s]!==f[s];if($&&!j)return;let v=!1;p((()=>y[s].$pending),(t=>{t||(v=!0)}));let g=[],h=[],w=l[s];if(w){Array.isArray(w)||(w=[w]);for(const o of w){const{test:a,message:c=null,name:i}=o;let l=a(n()[s],m(t),m(e),m(r));if(l instanceof Promise){y[s].$pending=!0;try{l=await l}catch(P){l=!1}v||(y[s].$pending=!1)}if(!l){const t="function"==typeof c?c(n()[s]):c;if(g=[...g,{name:i,message:t}],t&&h.push(t),b)break}}v||(d(u,s,j),d(y,s,i(c({},y[s]),{$errors:g,$messages:h,$invalid:Boolean(g.length)})))}},w=(t,e)=>{const{dirt:r,entries:o}=t;d(r,e,!1),d(o,e,c(c({},o[e]),v))},P=(t,e)=>{const{dirt:r}=t;d(r,e,!0)},T=()=>{y((()=>m(t)),m(e),o,s,n)};return T(),p(e,T),p(r,T),{result:u}};

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

var __defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,r)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,__spreadValues=(e,t)=>{for(var r in t||(t={}))__hasOwnProp.call(t,r)&&__defNormalProp(e,r,t[r]);if(__getOwnPropSymbols)for(var r of __getOwnPropSymbols(t))__propIsEnum.call(t,r)&&__defNormalProp(e,r,t[r]);return e},__spreadProps=(e,t)=>__defProps(e,__getOwnPropDescs(t));!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue-demi")):"function"==typeof define&&define.amd?define(["vue-demi"],t):(e="undefined"!=typeof globalThis?globalThis:e||self)["vue-tiny-validate"]=t(e.VueDemi)}(this,(function(e){"use strict";const t=(t,r,s)=>{e.isVue2?e.Vue2.set(t,r,s):t[r]=s},r=(e,t)=>void 0!==e[t],s=e=>"[object Object]"===Object.prototype.toString.call(e),o=t=>e.isRef(t)?t.value:t,a=()=>{},n={$invalid:!1,$errors:[],$messages:[],$pending:!1},i=e.reactive({autoTest:!1,autoTouch:!1,lazy:!1,firstError:!1,touchOnTest:!1,transform:e=>e});return(c,p,u=e.reactive({}))=>{const l=e.reactive({}),_=e.reactive({}),f=e.reactive({}),d=e.computed((()=>__spreadValues(__spreadValues({},i),o(u)))),y=e.computed((()=>{const e=m(f,l),{transform:t}=d.value;return t?t(e,o(c),o(p),o(u)):e})),m=(e,t)=>{const o=__spreadProps(__spreadValues({},n),{$dirty:!1,$test:a,$reset:a,$touch:a}),i=Object.keys(e),c={$test:[],$reset:[],$touch:[]},p=Object.keys(c),u=(e,t)=>{const r=[...Object.keys(n),"$dirty"];for(const s of r)Array.isArray(e[s])?e[s]=[...e[s],...t[s]]:!e[s]&&t[s]&&(e[s]=!0);for(const s of p)c[s].push(t[s])};for(const a of i)if(s(e[a])&&!r(e[a],"$invalid")){const r=m(e[a],t[a]);o[a]=__spreadValues({},r),u(o,r)}else o[a]=__spreadValues({},e[a]),o[a].$dirty=t[a],u(o,o[a]);for(const r of p)o[r]=()=>{if("$test"===r)return Promise.all(c[r].map((e=>e())));c[r].forEach((e=>e()))};return o},$=(o,a,i,c,p)=>{const u=Object.keys(a);for(const l of u)if(!s(a[l])||r(a[l],"test")||r(a[l],"name")){t(i,l,!1),t(c,l,o()[l]);const r={data:o,rules:a,dirt:i,rawData:c,entries:p};t(p,l,__spreadProps(__spreadValues({},n),{$reset:()=>O(r,l),$test:async()=>await b(r,l),$touch:()=>P(r,l)})),Object.setPrototypeOf(p[l],{$uw:e.watch((()=>o()[l]),(()=>{d.value.autoTest&&p[l].$test(),d.value.autoTouch&&p[l].$touch()}))})}else{t(c,l,{}),t(i,l,e.reactive({})),t(p,l,e.reactive({}));const r=[()=>o()[l],a[l],i[l],c[l],p[l]];$(...r)}},b=async(r,s)=>{const{data:a,rules:n,dirt:i,rawData:l,entries:_}=r,{lazy:f,firstError:y,touchOnTest:m}=d.value;let $=!1;const b=e.watch((()=>_[s].$pending),(e=>{e||($=!0,b())}));if(t(i,s,m||i[s]||a()[s]!==l[s]),f&&!i[s])return;let O=[],P=[],v=n[s];if(v){Array.isArray(v)||(v=[v]);for(const e of v){const{test:t,message:r=null,name:n}=e;let i=t(a()[s],o(c),o(p),o(u));if(i instanceof Promise){_[s].$pending=!0;try{i=await i}catch(h){i=!1}$||(_[s].$pending=!1)}if(!i){const e="function"==typeof r?r(a()[s]):r;if(O=[...O,{name:n,message:e}],e&&P.push(e),y)break}}$||t(_,s,__spreadProps(__spreadValues({},_[s]),{$errors:O,$messages:P,$invalid:Boolean(O.length)}))}},O=(e,r)=>{const{dirt:s,entries:o}=e;t(s,r,!1),t(o,r,__spreadValues(__spreadValues({},o[r]),n))},P=(e,r)=>{const{dirt:s}=e;t(s,r,!0)},v=()=>{$((()=>o(c)),o(p),l,_,f)};return v(),e.watch(p,v),e.watch(u,v),{result:y}}}));
var __defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,r)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,__spreadValues=(e,t)=>{for(var r in t||(t={}))__hasOwnProp.call(t,r)&&__defNormalProp(e,r,t[r]);if(__getOwnPropSymbols)for(var r of __getOwnPropSymbols(t))__propIsEnum.call(t,r)&&__defNormalProp(e,r,t[r]);return e},__spreadProps=(e,t)=>__defProps(e,__getOwnPropDescs(t));!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue-demi")):"function"==typeof define&&define.amd?define(["vue-demi"],t):(e="undefined"!=typeof globalThis?globalThis:e||self)["vue-tiny-validate"]=t(e.VueDemi)}(this,(function(e){"use strict";const t=(t,r,s)=>{e.isVue2?e.Vue2.set(t,r,s):t[r]=s},r=(e,t)=>void 0!==e[t],s=e=>"[object Object]"===Object.prototype.toString.call(e),o=t=>e.isRef(t)?t.value:t,a=()=>{},n={$invalid:!1,$errors:[],$messages:[],$pending:!1},i=e.reactive({autoTest:!1,autoTouch:!1,lazy:!1,firstError:!1,touchOnTest:!1,transform:e=>e});return(c,p,u=e.reactive({}))=>{const _=e.reactive({}),l=e.reactive({}),d=e.reactive({}),f=e.computed((()=>__spreadValues(__spreadValues({},i),o(u)))),y=e.computed((()=>{const e=m(d,_),{transform:t}=f.value;return t?t(e,o(c),o(p),o(u)):e})),m=(e,t)=>{const o=__spreadProps(__spreadValues({},n),{$dirty:!1,$test:a,$reset:a,$touch:a}),i=Object.keys(e),c={$test:[],$reset:[],$touch:[]},p=Object.keys(c),u=(e,t)=>{const r=[...Object.keys(n),"$dirty"];for(const s of r)Array.isArray(e[s])?e[s]=[...e[s],...t[s]]:!e[s]&&t[s]&&(e[s]=!0);for(const s of p)c[s].push(t[s])};for(const a of i)if(s(e[a])&&!r(e[a],"$invalid")){const r=m(e[a],t[a]);o[a]=__spreadValues({},r),u(o,r)}else o[a]=__spreadProps(__spreadValues({},e[a]),{$dirty:t[a]}),u(o,o[a]);for(const r of p)o[r]=()=>{const e=c[r].map((e=>e()));return"$test"===r?Promise.all(e):e};return o},P=(o,a,i,c,p)=>{const u=Object.keys(a);for(const _ of u)if(!s(a[_])||r(a[_],"test")||r(a[_],"name")){t(i,_,!1),t(c,_,o()[_]);const r={data:o,rules:a,dirt:i,rawData:c,entries:p};t(p,_,__spreadProps(__spreadValues({},n),{$reset:()=>b(r,_),$test:async()=>await $(r,_),$touch:()=>O(r,_)})),Object.setPrototypeOf(p[_],{$uw:e.watch((()=>o()[_]),(()=>{f.value.autoTest&&p[_].$test(),f.value.autoTouch&&p[_].$touch()}))})}else t(c,_,{}),t(i,_,e.reactive({})),t(p,_,e.reactive({})),P((()=>o()[_]),a[_],i[_],c[_],p[_])},$=async(r,s)=>{const{data:a,rules:n,dirt:i,rawData:_,entries:l}=r,{lazy:d,firstError:y,touchOnTest:m}=f.value,P=i[s]||m||a()[s]!==_[s];if(d&&!P)return;let $=!1;e.watch((()=>l[s].$pending),(e=>{e||($=!0)}));let b=[],O=[],v=n[s];if(v){Array.isArray(v)||(v=[v]);for(const e of v){const{test:t,message:r=null,name:n}=e;let i=t(a()[s],o(c),o(p),o(u));if(i instanceof Promise){l[s].$pending=!0;try{i=await i}catch(h){i=!1}$||(l[s].$pending=!1)}if(!i){const e="function"==typeof r?r(a()[s]):r;if(b=[...b,{name:n,message:e}],e&&O.push(e),y)break}}$||(t(i,s,P),t(l,s,__spreadProps(__spreadValues({},l[s]),{$errors:b,$messages:O,$invalid:Boolean(b.length)})))}},b=(e,r)=>{const{dirt:s,entries:o}=e;t(s,r,!1),t(o,r,__spreadValues(__spreadValues({},o[r]),n))},O=(e,r)=>{const{dirt:s}=e;t(s,r,!0)},v=()=>{P((()=>o(c)),o(p),_,l,d)};return v(),e.watch(p,v),e.watch(u,v),{result:y}}}));
{
"name": "vue-tiny-validate",
"version": "0.2.2",
"version": "0.2.4",
"description": "Tiny Vue Validate Composition",

@@ -38,6 +38,6 @@ "main": "dist/index.umd.js",

"dev:docs": "vitepress dev docs --port 4000",
"build": "yarn clean && yarn pretty && vite build --mode library && yarn type",
"build:lib": "yarn clean && yarn pretty && vite build --mode lib && yarn type",
"build:docs": "yarn clean && vitepress build docs",
"build:example": "yarn clean && yarn pretty && vite build --mode example",
"release": "np"
"release": "yarn build:lib && np"
},

@@ -48,3 +48,2 @@ "dependencies": {

"devDependencies": {
"@size-limit/preset-small-lib": "^4.11.0",
"@types/jest": "^26.0.23",

@@ -64,3 +63,2 @@ "@types/lodash": "^4.14.171",

"sass": "^1.34.1",
"size-limit": "^4.11.0",
"ts-jest": "^27.0.3",

@@ -71,3 +69,3 @@ "typescript": "^4.3.2",

"vitepress": "^0.15.3",
"vue": "^3.0.11",
"vue": "^3.2.4",
"vue-jest": "^5.0.0-alpha.10",

@@ -74,0 +72,0 @@ "windicss": "^3.1.3"

@@ -21,5 +21,5 @@ ## `vue-tiny-validate`

- Easy. Come with familiar API and coherent documentation.
- Tiny. No dependencies. Only **3KB** minified. **1.3KB** gzipped.
- Tiny. Only **3.4KB** minified. **1.4KB** gzipped.
- Flexible. Full control over everything.
- Fully functional. Sync validation, async validation, etc supported.\
- Fully functional. Sync validation, async validation, etc supported.
- Compatible. Works with both Vue 2.6 and Vue 3.

@@ -26,0 +26,0 @@