net: refactor to use more primordials

PR-URL: https://github.com/nodejs/node/pull/36303
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
Antoine du Hamel 2020-11-18 00:19:12 +01:00 committed by James M Snell
parent 5f1bf80b5e
commit 0869b829fa
No known key found for this signature in database
GPG key ID: 7341B15C070877AC
2 changed files with 18 additions and 12 deletions

View file

@ -2,6 +2,7 @@
const {
RegExp,
RegExpPrototypeTest,
Symbol,
} = primordials;
@ -28,11 +29,11 @@ const IPv6Reg = new RegExp('^(' +
')(%[0-9a-zA-Z-.:]{1,})?$');
function isIPv4(s) {
return IPv4Reg.test(s);
return RegExpPrototypeTest(IPv4Reg, s);
}
function isIPv6(s) {
return IPv6Reg.test(s);
return RegExpPrototypeTest(IPv6Reg, s);
}
function isIP(s) {