From e4d4323c0cabeb7e1e84fc39c30689a0785fd0fd Mon Sep 17 00:00:00 2001 From: Vse Mozhet Byt Date: Wed, 7 Jun 2017 17:34:50 +0300 Subject: [PATCH 1/2] dns: remove redundant RegExp part --- lib/dns.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/dns.js b/lib/dns.js index 6fcf37a85e6c12..390304d3060e30 100644 --- a/lib/dns.js +++ b/lib/dns.js @@ -315,7 +315,7 @@ function setServers(servers) { if (ipVersion !== 0) return newSet.push([ipVersion, serv]); - const match = serv.match(/\[(.*)\](?::\d+)?/); + const match = serv.match(/\[(.*)\]/); // we have an IPv6 in brackets if (match) { ipVersion = isIP(match[1]); From 3fbb0128975d41fb1d8073e8f7cd4826fdcc1ecf Mon Sep 17 00:00:00 2001 From: Vse Mozhet Byt Date: Wed, 7 Jun 2017 17:41:07 +0300 Subject: [PATCH 2/2] repl: remove redundant RegExp parts --- lib/repl.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/repl.js b/lib/repl.js index 051261a679ebeb..75d48dca545c14 100644 --- a/lib/repl.js +++ b/lib/repl.js @@ -772,7 +772,7 @@ function complete(line, callback) { name = files[f]; ext = path.extname(name); base = name.slice(0, -ext.length); - if (base.match(/-\d+\.\d+(\.\d+)?/) || name === '.npm') { + if (/-\d+\.\d+/.test(base) || name === '.npm') { // Exclude versioned names that 'npm' installs. continue; } @@ -1067,7 +1067,7 @@ REPLServer.prototype.memory = function memory(cmd) { self.lines.level.push({ line: self.lines.length - 1, depth: depth, - isFunction: /\s*function\s*/.test(cmd) + isFunction: /\bfunction\b/.test(cmd) }); } else if (depth < 0) { // going... up.