"use strict"; module.exports = function matchOrError(regex, string) { if (regex == null) { throw new Error("No regular expression was provided"); } else if (string == null) { throw new Error("No string to match on was provided"); } else { let match = regex.exec(string); if (match == null) { throw new Error(`Regular expression ${regex.toString()} failed to match on string: ${string}`); } else { return match.slice(1); } } };