refactor(config/validator): make validation sync

refactor(config/validator): convert to arrow function for consistency
This commit is contained in:
daedalus 2022-10-24 01:14:27 -04:00
parent d44577e9c4
commit c48e13fb0d
2 changed files with 4 additions and 8 deletions

View File

@ -1,11 +1,8 @@
'use strict';
const { pluginConfigSchema } = require('./schema');
const schema = require('./schema');
module.exports = {
async validator(config) {
await pluginConfigSchema.validate(config);
},
default: () => ({
contentTypes: {},
slugifyOptions: {},
@ -13,4 +10,5 @@ module.exports = {
shouldUpdateSlug: false,
skipUndefinedReferences: false,
}),
validator: (config) => schema.validateSync(config),
};

View File

@ -3,7 +3,7 @@
const yup = require('yup');
const _ = require('lodash');
const pluginConfigSchema = yup.object().shape({
const schema = yup.object().shape({
slugifyOptions: yup.object(),
contentTypes: yup.lazy((obj) => {
let shape = {};
@ -22,6 +22,4 @@ const pluginConfigSchema = yup.object().shape({
skipUndefinedReferences: yup.bool(),
});
module.exports = {
pluginConfigSchema,
};
module.exports = schema;