diff --git a/index.js b/index.js index 3ea3d20..b98a37f 100644 --- a/index.js +++ b/index.js @@ -11,10 +11,10 @@ module.exports = isUrl; * Use two levels of REs to avoid REDOS. */ -var protocolAndDomainRE = /^(?:\w+:)?\/\/(\S+)$/; +const protocolAndDomainRE = /^(?:\w+:)?\/\/(\S+)$/; -var localhostDomainRE = /^localhost[\:?\d]*(?:[^\:?\d]\S*)?$/ -var nonLocalhostDomainRE = /^[^\s\.]+\.\S{2,}$/; +const localhostDomainRE = /^localhost[\:?\d]*(?:[^\:?\d]\S*)?$/ +const nonLocalhostDomainRE = /^[^\s\.]+\.\S{2,}$/; /** * Loosely validate a URL `string`. @@ -28,12 +28,12 @@ function isUrl(string){ return false; } - var match = string.match(protocolAndDomainRE); + const match = string.match(protocolAndDomainRE); if (!match) { return false; } - var everythingAfterProtocol = match[1]; + const everythingAfterProtocol = match[1]; if (!everythingAfterProtocol) { return false; }