@effective-forms/yup
Advanced tools
| "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function o(r){const n={fields:{},validator:a=>{try{r.schema.validateSync(a,{abortEarly:!1})}catch(e){const t={},l=e;for(const s of l.inner)t[s.path]=s.errors;return{result:!1,errors:t}}return{result:!0}},clearOn:r.clearOn,validateOn:r.validateOn};for(const a in r.schema.fields){const e=a;n.fields[e]={init:r.initialValues[e],validator:t=>{try{r.schema.validateSyncAt(e,{[e]:t})}catch(l){return{result:!1,errors:l.errors}}return{result:!0}}}}return n}exports.yupSchema=o; |
+38
-1
@@ -1,1 +0,38 @@ | ||
| "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function o(r){const n={fields:{},validator:a=>{try{r.schema.validateSync(a,{abortEarly:!1})}catch(e){const t={},l=e;for(const s of l.inner)t[s.path]=s.errors;return{result:!1,errors:t}}return{result:!0}},clearOn:r.clearOn,validateOn:r.validateOn};for(const a in r.schema.fields){const e=a;n.fields[e]={init:r.initialValues[e],validator:t=>{try{r.schema.validateSyncAt(e,{[e]:t})}catch(l){return{result:!1,errors:l.errors}}return{result:!0}}}}return n}exports.yupSchema=o; | ||
| function o(r) { | ||
| const n = { | ||
| fields: {}, | ||
| validator: (a) => { | ||
| try { | ||
| r.schema.validateSync(a, { abortEarly: !1 }); | ||
| } catch (e) { | ||
| const t = {}, s = e; | ||
| for (const l of s.inner) | ||
| t[l.path] = l.errors; | ||
| return { result: !1, errors: t }; | ||
| } | ||
| return { result: !0 }; | ||
| }, | ||
| clearOn: r.clearOn, | ||
| validateOn: r.validateOn | ||
| }; | ||
| for (const a in r.schema.fields) { | ||
| const e = a; | ||
| n.fields[e] = { | ||
| init: r.initialValues[e], | ||
| validator: (t) => { | ||
| try { | ||
| r.schema.validateSyncAt(e, { | ||
| [e]: t | ||
| }); | ||
| } catch (s) { | ||
| return { result: !1, errors: s.errors }; | ||
| } | ||
| return { result: !0 }; | ||
| } | ||
| }; | ||
| } | ||
| return n; | ||
| } | ||
| export { | ||
| o as yupSchema | ||
| }; |
+11
-3
| { | ||
| "name": "@effective-forms/yup", | ||
| "version": "0.0.3", | ||
| "type": "commonjs", | ||
| "version": "0.0.4", | ||
| "type": "module", | ||
| "license": "MIT", | ||
| "exports": { | ||
| ".": { | ||
| "import": "./index.js", | ||
| "require": "./index.cjs", | ||
| "default": "./index.js", | ||
| "types": "./index.d.ts" | ||
| } | ||
| }, | ||
| "peerDependencies": { | ||
| "yup": "^1.2.0" | ||
| }, | ||
| "license": "MIT", | ||
| "keywords": [ | ||
@@ -10,0 +18,0 @@ "effector", |
-38
| function o(r) { | ||
| const n = { | ||
| fields: {}, | ||
| validator: (a) => { | ||
| try { | ||
| r.schema.validateSync(a, { abortEarly: !1 }); | ||
| } catch (e) { | ||
| const t = {}, s = e; | ||
| for (const l of s.inner) | ||
| t[l.path] = l.errors; | ||
| return { result: !1, errors: t }; | ||
| } | ||
| return { result: !0 }; | ||
| }, | ||
| clearOn: r.clearOn, | ||
| validateOn: r.validateOn | ||
| }; | ||
| for (const a in r.schema.fields) { | ||
| const e = a; | ||
| n.fields[e] = { | ||
| init: r.initialValues[e], | ||
| validator: (t) => { | ||
| try { | ||
| r.schema.validateSyncAt(e, { | ||
| [e]: t | ||
| }); | ||
| } catch (s) { | ||
| return { result: !1, errors: s.errors }; | ||
| } | ||
| return { result: !0 }; | ||
| } | ||
| }; | ||
| } | ||
| return n; | ||
| } | ||
| export { | ||
| o as yupSchema | ||
| }; |
2895
5.77%Yes
NaN