Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function runFunctions(fs) {
- let error;
- S.takeWhile(f => {
- error = S.encaseEither(S.I, f, null);
- return error.isRight;
- }, fs);
- return error;
- }
- function runTests() {
- const functionTester = (name, isError) => {
- return () => {
- console.log("running " + name);
- if (isError) {
- throw new Error(name)
- }
- }
- }
- return runFunctions([
- functionTester("one", false),
- functionTester("two", true),
- functionTester("three", false),
- functionTester("four", true),
- functionTester("five", false)
- ]);
- }
- const error = runTests();
- error.isLeft ? "got error: " + error.value : "All functions passed!"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement