From 927dc454c5cd5879ee52b1cc80cf6586fd8844c0 Mon Sep 17 00:00:00 2001 From: Dmitry Gorbachev Date: Wed, 31 Jan 2018 23:49:27 +0300 Subject: [PATCH] Added total validation for NaN format --- lib/node-progress.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/node-progress.js b/lib/node-progress.js index 2b62641..b9de1cc 100644 --- a/lib/node-progress.js +++ b/lib/node-progress.js @@ -52,7 +52,10 @@ function ProgressBar(fmt, options) { } else { options = options || {}; if ('string' != typeof fmt) throw new Error('format required'); - if ('number' != typeof options.total) throw new Error('total required'); + if ( + 'number' != typeof options.total + || isNaN(options.total) + ) throw new Error('total of number format required'); } this.fmt = fmt;