prompt-choices
Advanced tools
Comparing version
10
index.js
@@ -305,3 +305,3 @@ 'use strict'; | ||
Choices.prototype.get = function(key) { | ||
Choices.prototype.get = function(key, prop) { | ||
if (typeof key === 'string') { | ||
@@ -311,5 +311,9 @@ key = this.getIndex(key); | ||
if (!utils.isNumber(key)) { | ||
throw new TypeError('expected index to be a number or string'); | ||
return null; | ||
} | ||
return this.getChoice(key); | ||
var choice = this.getChoice(key); | ||
if (choice && typeof prop === 'string') { | ||
return choice[prop]; | ||
} | ||
return choice; | ||
}; | ||
@@ -316,0 +320,0 @@ |
{ | ||
"name": "prompt-choices", | ||
"description": "Create an array of multiple choice objects for use in prompts.", | ||
"version": "3.0.3", | ||
"version": "3.0.4", | ||
"homepage": "https://github.com/enquirer/prompt-choices", | ||
@@ -6,0 +6,0 @@ "author": "Jon Schlinkert (https://github.com/jonschlinkert)", |
39014
0.13%893
0.45%