From 7adc136a3645f5db9ba38310c740b32926858cd7 Mon Sep 17 00:00:00 2001 From: avasilkov Date: Fri, 18 May 2018 07:09:55 +0300 Subject: [PATCH] fix npm driver boolean arguments - Boolean(false) or Boolean(0) is still true, arguments were always true if they were included in the cli independent of values (#2290) --- src/drivers/npm/driver.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/drivers/npm/driver.js b/src/drivers/npm/driver.js index 0dcaac739..e1deba751 100644 --- a/src/drivers/npm/driver.js +++ b/src/drivers/npm/driver.js @@ -25,14 +25,14 @@ class Driver { htmlMaxRows: 2000, }, options || {}); - this.options.debug = Boolean(this.options.debug); + this.options.debug = Boolean(+this.options.debug); + this.options.recursive = Boolean(+this.options.recursive); this.options.delay = this.options.recursive ? parseInt(this.options.delay, 10) : 0; this.options.maxDepth = parseInt(this.options.maxDepth, 10); this.options.maxUrls = parseInt(this.options.maxUrls, 10); this.options.maxWait = parseInt(this.options.maxWait, 10); this.options.htmlMaxCols = parseInt(this.options.htmlMaxCols, 10); this.options.htmlMaxRows = parseInt(this.options.htmlMaxRows, 10); - this.options.recursive = Boolean(this.options.recursive); this.origPageUrl = url.parse(pageUrl); this.analyzedPageUrls = []; @@ -296,7 +296,7 @@ class Driver { this.fetch(pageUrl, index, depth) .catch(() => {}) .then(links => { - if ( links && Boolean(this.options.recursive) && depth < this.options.maxDepth ) { + if ( links && this.options.recursive && depth < this.options.maxDepth ) { return this.chunk(links.slice(0, this.options.maxUrls), depth + 1); } else { return Promise.resolve();