mirror of
https://github.com/vuejs/vue-cli.git
synced 2026-01-14 19:30:14 -06:00
18 lines
340 B
JavaScript
18 lines
340 B
JavaScript
const joi = require('joi')
|
|
|
|
// proxy to joi for option validation
|
|
exports.createSchema = fn => fn(joi)
|
|
|
|
exports.validate = (obj, schema, cb) => {
|
|
joi.validate(obj, schema, {}, err => {
|
|
if (err) {
|
|
cb(err.message)
|
|
if (process.env.VUE_CLI_TEST) {
|
|
throw err
|
|
} else {
|
|
process.exit(1)
|
|
}
|
|
}
|
|
})
|
|
}
|