ccashfrontend/views/node_modules/libphonenumber-js/source/helpers/matchesEntirely.js
2021-06-18 09:20:09 +10:00

11 lines
No EOL
416 B
JavaScript

/**
* Checks whether the entire input sequence can be matched
* against the regular expression.
* @return {boolean}
*/
export default function matchesEntirely(text, regular_expression) {
// If assigning the `''` default value is moved to the arguments above,
// code coverage would decrease for some weird reason.
text = text || ''
return new RegExp('^(?:' + regular_expression + ')$').test(text)
}