prettierx
Version:
prettierX - a less opinionated fork of the Prettier code formatter
18 lines (15 loc) • 334 B
JavaScript
;
function tryCombinations(...combinations) {
let firstError;
for (const [index, fn] of combinations.entries()) {
try {
return { result: fn() };
} catch (error) {
if (index === 0) {
firstError = error;
}
}
}
return { error: firstError };
}
module.exports = tryCombinations;