workerize
workerize copied to clipboard
refactor: flatten nested if-else blocks
apply "return early, avoid else" practice to make code simple and easy to read
Need to check the effect on filesize, but I'd imagine this is a savings! (due to uglify better optimizing early returns than nested conditionals)
hey @cades - that nested .then() is important - without it, an exception thrown by the method being called won't be passed back via RPC, it'll just be emitted as an error in the worker.
@developit thanks for point that out! Seems my knowledge to Promise is not promising 😂
BTW, if you think it is OK to accept this PR, I'm willing to squash these commits into a single commit before merge.