Fix: keyInSelect does not check empty items.

This commit is contained in:
anseki 2015-05-23 14:19:21 +09:00
parent 7b20ed4e72
commit 7c36922564
2 changed files with 2 additions and 2 deletions

View file

@ -1190,7 +1190,7 @@ exports.keyInSelect = function(items, query, options) {
}), }),
// added: guide, cancel // added: guide, cancel
keylist = '', key2i = {}, charCode = 49 /* '1' */, display = '\n'; keylist = '', key2i = {}, charCode = 49 /* '1' */, display = '\n';
if (!Array.isArray(items) || items.length > 35) if (!Array.isArray(items) || !items.length || items.length > 35)
{ throw '`items` must be Array (max length: 35).'; } { throw '`items` must be Array (max length: 35).'; }
items.forEach(function(item, i) { items.forEach(function(item, i) {

View file

@ -1,6 +1,6 @@
{ {
"name": "readline-sync", "name": "readline-sync",
"version": "1.2.15", "version": "1.2.16",
"title": "readlineSync", "title": "readlineSync",
"description": "Synchronous Readline for interactively running to have a conversation with the user via a console(TTY).", "description": "Synchronous Readline for interactively running to have a conversation with the user via a console(TTY).",
"keywords": [ "keywords": [