minimal adjustments
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / table / dist / validateConfig.js.flow
1 import validators from '../dist/validators';
2
3 /**
4  * @param {string} schemaId
5  * @param {formatData~config} config
6  * @returns {undefined}
7  */
8 export default (schemaId, config = {}) => {
9   const validate = validators[schemaId];
10   if (!validate(config)) {
11     const errors = validate.errors.map((error) => {
12       return {
13         dataPath: error.dataPath,
14         message: error.message,
15         params: error.params,
16         schemaPath: error.schemaPath,
17       };
18     });
19
20     /* eslint-disable no-console */
21     console.log('config', config);
22     console.log('errors', errors);
23     /* eslint-enable no-console */
24
25     throw new Error('Invalid config.');
26   }
27 };