Skip to content
This repository has been archived by the owner on Aug 31, 2018. It is now read-only.

Commit

Permalink
url: fix permanent deoptimizations
Browse files Browse the repository at this point in the history
PR-URL: nodejs/node#12456
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
mscdex committed Apr 30, 2017
1 parent a641b7c commit 8491c70
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions lib/internal/url.js
Original file line number Diff line number Diff line change
Expand Up @@ -232,9 +232,9 @@ class URL {
if (typeof depth === 'number' && depth < 0)
return opts.stylize('[Object]', 'special');

const ctor = getConstructorOf(this);
var ctor = getConstructorOf(this);

const obj = Object.create({
var obj = Object.create({
constructor: ctor === null ? URL : ctor
});

Expand Down Expand Up @@ -879,20 +879,20 @@ class URLSearchParams {
if (typeof recurseTimes === 'number' && recurseTimes < 0)
return ctx.stylize('[Object]', 'special');

const separator = ', ';
const innerOpts = Object.assign({}, ctx);
var separator = ', ';
var innerOpts = Object.assign({}, ctx);
if (recurseTimes !== null) {
innerOpts.depth = recurseTimes - 1;
}
const innerInspect = (v) => util.inspect(v, innerOpts);
var innerInspect = (v) => util.inspect(v, innerOpts);

const list = this[searchParams];
const output = [];
var list = this[searchParams];
var output = [];
for (var i = 0; i < list.length; i += 2)
output.push(`${innerInspect(list[i])} => ${innerInspect(list[i + 1])}`);

const colorRe = /\u001b\[\d\d?m/g;
const length = output.reduce(
var colorRe = /\u001b\[\d\d?m/g;
var length = output.reduce(
(prev, cur) => prev + cur.replace(colorRe, '').length + separator.length,
-separator.length
);
Expand Down

0 comments on commit 8491c70

Please sign in to comment.