Added some tests
This commit is contained in:
8
test/attempt/attempt.js
Normal file
8
test/attempt/attempt.js
Normal file
@@ -0,0 +1,8 @@
|
||||
const attempt = (fn, ...args) => {
|
||||
try {
|
||||
return fn(args);
|
||||
} catch (e) {
|
||||
return e instanceof Error ? e : new Error(e);
|
||||
}
|
||||
};
|
||||
module.exports = attempt
|
||||
Reference in New Issue
Block a user