From f03c4bd7f7c5108284167943f26a209d87daa2e4 Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Fri, 8 Jan 2021 17:47:38 -0500 Subject: [PATCH] bin scripts: compare against null, not undefined --- bin/checkAllPads.js | 4 ++-- bin/checkPad.js | 8 ++++---- bin/checkPadDeltas.js | 4 +--- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/bin/checkAllPads.js b/bin/checkAllPads.js index 6e1f14842..8426d4429 100644 --- a/bin/checkAllPads.js +++ b/bin/checkAllPads.js @@ -30,7 +30,7 @@ npm.load({}, async () => { const pad = await padManager.getPad(padId); // check if the pad has a pool - if (pad.pool === undefined) { + if (pad.pool == null) { console.error(`[${pad.id}] Missing attribute pool`); continue; } @@ -66,7 +66,7 @@ npm.load({}, async () => { } // check if there is a atext in the keyRevisions - if (revisions[keyRev].meta === undefined || revisions[keyRev].meta.atext === undefined) { + if (revisions[keyRev].meta == null || revisions[keyRev].meta.atext == null) { console.error(`[${pad.id}] Missing atext in revision ${keyRev}`); continue; } diff --git a/bin/checkPad.js b/bin/checkPad.js index de1c51402..374a3c856 100644 --- a/bin/checkPad.js +++ b/bin/checkPad.js @@ -59,12 +59,12 @@ npm.load({}, async () => { } // check if the pad has a pool - if (pad.pool === undefined) throw new Error('Attribute pool is missing'); + if (pad.pool == null) throw new Error('Attribute pool is missing'); // check if there is an atext in the keyRevisions - if (revisions[keyRev] === undefined || - revisions[keyRev].meta === undefined || - revisions[keyRev].meta.atext === undefined) { + if (revisions[keyRev] == null || + revisions[keyRev].meta == null || + revisions[keyRev].meta.atext == null) { console.error(`No atext in key revision ${keyRev}`); continue; } diff --git a/bin/checkPadDeltas.js b/bin/checkPadDeltas.js index ecbb20846..c53275a28 100644 --- a/bin/checkPadDeltas.js +++ b/bin/checkPadDeltas.js @@ -55,9 +55,7 @@ npm.load({}, async () => { const revision = await db.get(`pad:${padId}:revs:${revNum}`); // check if there is a atext in the keyRevisions if (~keyRevisions.indexOf(revNum) && - (revision === undefined || - revision.meta === undefined || - revision.meta.atext === undefined)) { + (revision == null || revision.meta == null || revision.meta.atext == null)) { console.error(`No atext in key revision ${revNum}`); continue; }