Skip to content

Commit 647753c

Browse files
Configurable validation options
1 parent 64b29c4 commit 647753c

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

client/index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ const validator = require('../validator')
55
const validatorOptions = {
66
greedy: true,
77
formats: {
8-
uuid: /^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i
8+
uuid: /^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,
9+
objectid: /^[a-f\d]{24}$/i
910
}
1011
}
1112

@@ -62,7 +63,8 @@ const superviews = (options, Base = window.HTMLElement) => class Superviews exte
6263
*/
6364
const schema = options.schema
6465
if (schema && schema.properties) {
65-
const validate = validator(schema, validatorOptions)
66+
const opts = options.validatorOptions || validatorOptions
67+
const validate = validator(schema, opts)
6668
const props = schema.properties
6769
const keys = Object.keys(props)
6870

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "superviews.js",
3-
"version": "3.0.1",
3+
"version": "3.0.2",
44
"description": "Template engine compiler targeting incremental-dom by Google",
55
"main": "index.js",
66
"browser": "client/index.js",

0 commit comments

Comments
 (0)