Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

prompt-question

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

prompt-question - npm Package Compare versions

Comparing version 4.0.0 to 4.0.1

25

index.js
'use strict';
var debug = require('debug')('prompt-question');
var extend = require('extend-shallow');
var Choices = require('prompt-choices');

@@ -40,2 +41,3 @@ var define = require('define-property');

this.options = {};
this.getDefault();

@@ -145,2 +147,19 @@ if (Array.isArray(message)) {

Question.prototype.getDefault = function(val) {
var def = koalas(this.default, this.options.default, this.choices.default);
if (def == null) {
return def;
}
if (this.choices.length) {
var idx = this.choices.getIndex(def);
if (typeof idx === 'number') {
this.choices.default = idx;
this.choices.check(idx);
def = idx;
}
}
this.default = def;
return def;
};
Question.prototype.getAnswer = function(val) {

@@ -213,7 +232,7 @@ if (this._choices && !this.choices.checked.length && this.default != null) {

set: function(choices) {
this._choices = new Choices(choices, this.options);
define(this, '_choices', new Choices(choices, this));
},
get: function() {
if (typeof this._choices === 'undefined') {
this._choices = new Choices(this.options.choices, this.options);
if (this._choices == null) {
define(this, '_choices', new Choices(this.options.choices, this));
}

@@ -220,0 +239,0 @@ return this._choices;

@@ -38,2 +38,3 @@ 'use strict';

}
define(question, 'cache', cache);

@@ -40,0 +41,0 @@ var opts = question.options;

38

package.json
{
"name": "prompt-question",
"description": "Question object, used by Enquirer and prompt plugins.",
"version": "4.0.0",
"version": "4.0.1",
"homepage": "https://github.com/enquirer/prompt-question",

@@ -23,20 +23,2 @@ "author": "Jon Schlinkert (https://github.com/jonschlinkert)",

},
"dependencies": {
"clone-deep": "^0.3.0",
"debug": "^2.6.8",
"define-property": "^1.0.0",
"extend-shallow": "^2.0.1",
"kind-of": "^4.0.0",
"koalas": "^1.0.2",
"prompt-choices": "^4.0.0"
},
"devDependencies": {
"gulp": "^3.9.1",
"gulp-eslint": "^3.0.1",
"gulp-format-md": "^0.1.12",
"gulp-istanbul": "^1.1.1",
"gulp-mocha": "^3.0.1",
"gulp-unused": "^0.2.1",
"mocha": "^3.4.2"
},
"keywords": [

@@ -94,3 +76,21 @@ "answer",

}
},
"dependencies": {
"clone-deep": "^0.3.0",
"debug": "^2.6.8",
"define-property": "^1.0.0",
"extend-shallow": "^2.0.1",
"kind-of": "^4.0.0",
"koalas": "^1.0.2",
"prompt-choices": "^4.0.1"
},
"devDependencies": {
"gulp": "^3.9.1",
"gulp-eslint": "^3.0.1",
"gulp-format-md": "^0.1.12",
"gulp-istanbul": "^1.1.1",
"gulp-mocha": "^3.0.1",
"gulp-unused": "^0.2.1",
"mocha": "^3.4.2"
}
}

@@ -45,3 +45,3 @@ # prompt-question [![NPM version](https://img.shields.io/npm/v/prompt-question.svg?style=flat)](https://www.npmjs.com/package/prompt-question) [![NPM monthly downloads](https://img.shields.io/npm/dm/prompt-question.svg?style=flat)](https://npmjs.org/package/prompt-question) [![NPM total downloads](https://img.shields.io/npm/dt/prompt-question.svg?style=flat)](https://npmjs.org/package/prompt-question) [![Linux Build Status](https://img.shields.io/travis/enquirer/prompt-question.svg?style=flat&label=Travis)](https://travis-ci.org/enquirer/prompt-question)

* [choices-separator](https://www.npmjs.com/package/choices-separator): Separator for choices arrays in prompts. Based on the Separator from inquirer. | [homepage](https://github.com/enquirer/choices-separator "Separator for choices arrays in prompts. Based on the Separator from inquirer.")
* [enquirer](https://www.npmjs.com/package/enquirer): Intuitive, plugin-based prompt system for node.js. Much faster and lighter alternative to Inquirer, with all… [more](https://github.com/enquirer/enquirer) | [homepage](https://github.com/enquirer/enquirer "Intuitive, plugin-based prompt system for node.js. Much faster and lighter alternative to Inquirer, with all the same prompt types and more, but without the bloat.")
* [enquirer](https://www.npmjs.com/package/enquirer): Intuitive, plugin-based prompt system for node.js. | [homepage](http://enquirer.io "Intuitive, plugin-based prompt system for node.js.")
* [prompt-choices](https://www.npmjs.com/package/prompt-choices): Create an array of multiple choice objects for use in prompts. | [homepage](https://github.com/enquirer/prompt-choices "Create an array of multiple choice objects for use in prompts.")

@@ -88,2 +88,2 @@ * [readline-utils](https://www.npmjs.com/package/readline-utils): Readline utils, for moving the cursor, clearing lines, creating a readline interface, and more. | [homepage](https://github.com/enquirer/readline-utils "Readline utils, for moving the cursor, clearing lines, creating a readline interface, and more.")

_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on May 17, 2017._
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on June 02, 2017._
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc