From e2a13b05b1472bda7b394a9f02e9b40765d8d942 Mon Sep 17 00:00:00 2001 From: BoHong Li Date: Fri, 2 Aug 2019 01:01:02 +0800 Subject: [PATCH] refactor: fix lint on lib/workers/dmpWorker.js Signed-off-by: BoHong Li --- lib/workers/dmpWorker.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/workers/dmpWorker.js b/lib/workers/dmpWorker.js index c00952d1..d999cc72 100644 --- a/lib/workers/dmpWorker.js +++ b/lib/workers/dmpWorker.js @@ -13,7 +13,7 @@ process.on('message', function (data) { } switch (data.msg) { case 'create patch': - if (!data.hasOwnProperty('lastDoc') || !data.hasOwnProperty('currDoc')) { + if (!Object.hasOwnProperty.call(data, 'lastDoc') || !Object.hasOwnProperty.call(data, 'currDoc')) { return logger.error('dmp worker error: not enough data on create patch') } try { @@ -33,7 +33,7 @@ process.on('message', function (data) { } break case 'get revision': - if (!data.hasOwnProperty('revisions') || !data.hasOwnProperty('count')) { + if (!Object.hasOwnProperty.call(data, 'revisions') || !Object.hasOwnProperty.call(data, 'count')) { return logger.error('dmp worker error: not enough data on get revision') } try { @@ -77,12 +77,12 @@ function getRevision (revisions, count) { if (count <= Math.round(revisions.length / 2)) { // start from top to target for (let i = 0; i < count; i++) { - let revision = revisions[i] + const revision = revisions[i] if (i === 0) { startContent = revision.content || revision.lastContent } if (i !== count - 1) { - let patch = dmp.patch_fromText(revision.patch) + const patch = dmp.patch_fromText(revision.patch) applyPatches = applyPatches.concat(patch) } lastPatch = revision.patch @@ -99,13 +99,13 @@ function getRevision (revisions, count) { // start from bottom to target var l = revisions.length - 1 for (var i = l; i >= count - 1; i--) { - let revision = revisions[i] + const revision = revisions[i] if (i === l) { startContent = revision.lastContent authorship = revision.authorship } if (revision.patch) { - let patch = dmp.patch_fromText(revision.patch) + const patch = dmp.patch_fromText(revision.patch) applyPatches = applyPatches.concat(patch) } lastPatch = revision.patch