$data: true,
error,
code(cxt: KeywordCxt) {
- const {gen, data, $data, schema, schemaCode} = cxt
- const regExp = $data ? _`(new RegExp(${schemaCode}, "u"))` : usePattern(gen, schema) // TODO regexp should be wrapped in try/catch
+ const {data, $data, schema, schemaCode, it} = cxt
+ // TODO regexp should be wrapped in try/catchs
+ const u = it.opts.unicodeRegExp ? "u" : ""
+ const regExp = $data ? _`(new RegExp(${schemaCode}, ${u}))` : usePattern(cxt, schema)
cxt.fail$data(_`!${regExp}.test(${data})`)
},
}