"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? // FIXME: Maybe we can get rid of this entirely? Now that we no longer have to handle NotEnoughInput within core-ops anymore at all module.exports = function ifMatch(testResult, produceResult) { if (testResult === NoMatch || testResult === NotEnoughInput) { return testResult; } else { return produceResult(testResult); } };