matchesEntirely.js 460 B

123456789101112
  1. /**
  2. * Checks whether the entire input sequence can be matched
  3. * against the regular expression.
  4. * @return {boolean}
  5. */
  6. export default function matchesEntirely(text, regular_expression) {
  7. // If assigning the `''` default value is moved to the arguments above,
  8. // code coverage would decrease for some weird reason.
  9. text = text || '';
  10. return new RegExp('^(?:' + regular_expression + ')$').test(text);
  11. }
  12. //# sourceMappingURL=matchesEntirely.js.map