chore(package): update xo to version 0.21.0
This commit is contained in:
committed by
Pierre Vanduynslager
parent
cd9f2bdd44
commit
f3e4991819
+15
-16
@@ -37,21 +37,20 @@ module.exports = (pluginType, pluginsPath, globalOpts, pluginOpts, logger) => {
|
||||
throw getError('EPLUGIN', {pluginType, pluginName});
|
||||
}
|
||||
|
||||
return Object.defineProperty(
|
||||
async input => {
|
||||
const definition = PLUGINS_DEFINITIONS[pluginType];
|
||||
try {
|
||||
const result = await func(cloneDeep(input));
|
||||
if (definition && definition.output && !definition.output.validator(result)) {
|
||||
throw getError(PLUGINS_DEFINITIONS[pluginType].output.error, {result, pluginName});
|
||||
}
|
||||
return result;
|
||||
} catch (err) {
|
||||
extractErrors(err).forEach(err => Object.assign(err, {pluginName}));
|
||||
throw err;
|
||||
const validator = async input => {
|
||||
const definition = PLUGINS_DEFINITIONS[pluginType];
|
||||
try {
|
||||
const result = await func(cloneDeep(input));
|
||||
if (definition && definition.output && !definition.output.validator(result)) {
|
||||
throw getError(PLUGINS_DEFINITIONS[pluginType].output.error, {result, pluginName});
|
||||
}
|
||||
},
|
||||
'pluginName',
|
||||
{value: pluginName, writable: false, enumerable: true}
|
||||
);
|
||||
return result;
|
||||
} catch (err) {
|
||||
extractErrors(err).forEach(err => Object.assign(err, {pluginName}));
|
||||
throw err;
|
||||
}
|
||||
};
|
||||
|
||||
Reflect.defineProperty(validator, 'pluginName', {value: pluginName, writable: false, enumerable: true});
|
||||
return validator;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user