@globalbrain/sefirot
Advanced tools
Comparing version 0.8.8 to 0.8.9
@@ -8,4 +8,5 @@ import { email as baseEmail } from '../validators' | ||
message, | ||
optional: true, | ||
validate: baseEmail | ||
} | ||
} |
import required from './required' | ||
import email from './email' | ||
import url from './url' | ||
@@ -7,2 +8,3 @@ export interface Rule { | ||
message: string | ||
optional: boolean | ||
validate (value: any, data: Record<string, any>): boolean | ||
@@ -13,3 +15,4 @@ } | ||
required, | ||
email, | ||
url | ||
} |
@@ -8,4 +8,5 @@ import { required as baseRequired } from '../validators' | ||
message, | ||
optional: false, | ||
validate: baseRequired | ||
} | ||
} |
@@ -54,3 +54,9 @@ import { ref, computed, toRefs, Ref } from '@vue/composition-api' | ||
return validators.reduce<Error[]>((errors, validator) => { | ||
if (!validator.validate(data[name], rootData)) { | ||
const d = data[name] | ||
if (validator.optional && (d === undefined || d === null || d === '')) { | ||
return errors | ||
} | ||
if (!validator.validate(d, rootData)) { | ||
errors.push([validator.name, validator.message]) | ||
@@ -57,0 +63,0 @@ } |
import required from './required' | ||
import email from './email' | ||
import url from './url' | ||
export { | ||
required, | ||
email, | ||
url | ||
} |
{ | ||
"name": "@globalbrain/sefirot", | ||
"version": "0.8.8", | ||
"version": "0.8.9", | ||
"description": "Vue Components for Global Brain Design System.", | ||
@@ -35,5 +35,8 @@ "files": [ | ||
"devDependencies": { | ||
"@babel/core": "^7.9.0", | ||
"@babel/plugin-proposal-object-rest-spread": "^7.9.0", | ||
"@babel/preset-env": "^7.9.0", | ||
"@juggle/resize-observer": "^3.1.2", | ||
"@nuxt/typescript-build": "^0.6.0", | ||
"@nuxt/typescript-runtime": "^0.4.0", | ||
"@nuxt/typescript-build": "^0.6.1", | ||
"@nuxt/typescript-runtime": "^0.4.1", | ||
"@nuxtjs/dotenv": "^1.4.1", | ||
@@ -46,11 +49,9 @@ "@nuxtjs/eslint-config-typescript": "^1.0.2", | ||
"@vue/test-utils": "^1.0.0-beta.32", | ||
"babel-core": "^6.26.3", | ||
"babel-eslint": "^10.1.0", | ||
"babel-jest": "^25.1.0", | ||
"babel-plugin-transform-object-rest-spread": "^6.26.0", | ||
"babel-preset-env": "^1.7.0", | ||
"babel-jest": "^25.2.4", | ||
"codecov": "^3.6.5", | ||
"core-js": "^2.6.10", | ||
"dayjs": "^1.8.23", | ||
"eslint": "^6.8.0", | ||
"jest": "^25.1.0", | ||
"jest": "^25.2.4", | ||
"jest-serializer-vue": "^2.0.2", | ||
@@ -60,3 +61,3 @@ "markdown-it-highlight": "^0.2.0", | ||
"normalize.css": "^8.0.1", | ||
"nuxt": "^2.12.0", | ||
"nuxt": "^2.12.1", | ||
"portal-vue": "^2.1.7", | ||
@@ -67,7 +68,7 @@ "postcss-custom-properties": "^9.1.1", | ||
"simplebar-vue": "^1.4.0", | ||
"ts-jest": "^25.2.1", | ||
"ts-jest": "^25.3.0", | ||
"typescript": "^3.8.3", | ||
"v-calendar": "^1.0.1", | ||
"vue": "^2.6.11", | ||
"vue-jest": "^3.0.5", | ||
"vue-jest": "^4.0.0-beta.2", | ||
"vue-router": "^3.1.6", | ||
@@ -77,4 +78,4 @@ "vue-server-renderer": "^2.6.11", | ||
"vuelidate": "^0.7.5", | ||
"webpack": "^4.42.0" | ||
"webpack": "^4.42.1" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
781
124261
40
96