From 447f8cb1fc9436e4213de800d6c86c5b15ccef73 Mon Sep 17 00:00:00 2001 From: Simon B Date: Mon, 8 Apr 2019 10:18:01 +0200 Subject: [PATCH] Attempting to fix .else Hi! We at tretton37 found a bug in the .else branch. Comparing https://github.com/becdetat/Simplicity/blob/master/src/Simplicity/PatternMatching.cs I guess I've made the right fix. But would need some tests and maybe a mention in the docs how multiple .else should work. I guess this is a breaking change, so 4.x? SemVer grumble grumble ^_^ --- simplicity.es6.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/simplicity.es6.js b/simplicity.es6.js index e59d7c8..d48f401 100644 --- a/simplicity.es6.js +++ b/simplicity.es6.js @@ -18,7 +18,8 @@ export default function match(matchOn) { return self; }; self.else = result => { - elseCase = result || (() => result); + if (elseCase) console.error("InvalidOperationException: Cannot have multiple else cases"); + else elseCase = result; return self; };