Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const convert = (result: any) => {
if (!Array.isArray(fields)) {
return result;
}
return _.pick(result, ...fields);
};
function toError (error) {
if (error.code === 'ECONNREFUSED') {
throw new Unavailable(error.message, _.pick(error, 'address', 'port', 'config'));
}
throw convert(error);
}