chore(package): update xo to version 0.21.0

This commit is contained in:
greenkeeper[bot]
2018-05-04 16:06:24 -04:00
committed by Pierre Vanduynslager
parent cd9f2bdd44
commit f3e4991819
10 changed files with 29 additions and 40 deletions
+15 -16
View File
@@ -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;
};