mirror of
https://github.com/ComfortablyCoding/strapi-plugin-slugify.git
synced 2025-12-20 00:01:04 -05:00
refactor(config/validator): make validation sync
refactor(config/validator): convert to arrow function for consistency
This commit is contained in:
parent
d44577e9c4
commit
c48e13fb0d
@ -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),
|
||||
};
|
||||
|
||||
@ -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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user