From b6523df7da03f151c6255bb7399c391c6f6ffecf Mon Sep 17 00:00:00 2001 From: Junv Zhao Date: Mon, 12 Jun 2017 10:48:49 +0800 Subject: [PATCH] Fix the bug of when there is no default person to pronounce --- package.json | 2 +- say-it.js | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 5bc6c0e..aef0541 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "say-it", - "version": "0.1.3", + "version": "0.1.4", "description": "Read the text you typed in command line by using Baidu tts.", "main": "say-it.js", "bin": { diff --git a/say-it.js b/say-it.js index 5b2cc49..0ab6bfe 100755 --- a/say-it.js +++ b/say-it.js @@ -20,7 +20,7 @@ var person = 0 charm.pipe(process.stdout); program - .version('0.0.1') + .version('0.1') .command(' ', 'read the texts you typed in', { isDefault: true }) @@ -31,7 +31,8 @@ program.on('*', () => { if (!text || text.trim() === '') { return showError() } - if (!_.includes([0, 1, 2, 3, 4], Number.parseInt(program.person))) { + + if (!!program.person && !_.includes([0, 1, 2, 3, 4], Number.parseInt(program.person))) { return showError(TEXTS.invalidPerson) } person = Number.parseInt(program.person)