in js/src/isValidUrl.js [13:22]
function isValidMatch(string, regex, optional) {
if (!optional) {
// RegExp["$&"] is the text of the last match
// blank strings are ok, but are falsy, so we check stringiness instead of truthiness
return typeof string === 'string' && string.match(regex) && RegExp['$&'] === string;
}
// RegExp["$&"] is the text of the last match
return !string || (string.match(regex) && RegExp['$&'] === string);
}