"use strict"; const { NoMatch, NotEnoughInput } = require("./symbols"); // This is a utility function for propagating NoMatches through the stack, without resorting to `throw`/`catch` (which can be slow) // FIXME: Use a Result type instead? module.exports = function ifMatch(testResult, produceResult) { if (testResult === NoMatch || testResult === NotEnoughInput) { return testResult; } else { return produceResult(testResult); } };