diff --git a/lib/fund.js b/lib/fund.js index 217a21d1fc3e3..25d3462f63869 100644 --- a/lib/fund.js +++ b/lib/fund.js @@ -63,7 +63,7 @@ class Fund extends BaseCommand { const fundingSourceNumber = numberArg && parseInt(numberArg, 10) const badFundingSourceNumber = - numberArg !== undefined && + numberArg !== null && (String(fundingSourceNumber) !== numberArg || fundingSourceNumber < 1) if (badFundingSourceNumber) { diff --git a/test/lib/fund.js b/test/lib/fund.js index bd600dbf75c01..8c10007844f0a 100644 --- a/test/lib/fund.js +++ b/test/lib/fund.js @@ -186,7 +186,7 @@ const config = { json: false, global: false, unicode: false, - which: undefined, + which: null, } const openUrl = async (npm, url, msg) => { if (url === 'http://npmjs.org') @@ -563,7 +563,7 @@ test('fund using nested packages with multiple sources, with a source number', t t.ifError(err, 'should not error out') t.matchSnapshot(printUrl, 'should open the numbered URL') - config.which = undefined + config.which = null printUrl = '' t.end() }) @@ -663,7 +663,7 @@ test('fund using bad which value', t => { 'should have bad which option error message' ) - config.which = undefined + config.which = null result = '' t.end() })