From f8e07526f60de22fcb2cc3f91deb68eeb97b1372 Mon Sep 17 00:00:00 2001 From: Jamie Peabody Date: Thu, 30 Dec 2021 08:48:22 +0000 Subject: [PATCH] chore: modernize --- src/diff.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/diff.js b/src/diff.js index d652e05..27fe450 100644 --- a/src/diff.js +++ b/src/diff.js @@ -264,9 +264,8 @@ CodeifyText.prototype._diff_ctx = function(lines) { } CodeifyText.prototype._codeify = function(lines, ctx) { - var code = this._max_code; - for (var i = 0; i < lines.length; ++i) { - var line = lines[i]; + for (let i = 0; i < lines.length; ++i) { + let line = lines[i]; if (this.options.ignorews) { line = line.replace(/\s+/g, ''); } @@ -276,12 +275,11 @@ CodeifyText.prototype._codeify = function(lines, ctx) { if (this.options.ignoreaccents) { line = line.normalize('NFD').replace(/[\u0300-\u036f]/g, ''); } - var aCode = this._diff_codes[line]; - if (aCode != undefined) { + const aCode = this._diff_codes[line]; + if (aCode !== undefined) { ctx.codes[i] = aCode; - } - else { - this._max_code++; + } else { + ++this._max_code; this._diff_codes[line] = this._max_code; ctx.codes[i] = this._max_code; }