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

prompt-for

Package Overview
Dependencies
Maintainers
2
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

prompt-for - npm Package Compare versions

Comparing version 0.4.1 to 0.5.0

4

History.md
0.5.0 - October 4, 2014
-----------------------
* add list support
0.4.1 - May 28, 2014

@@ -3,0 +7,0 @@ --------------------

@@ -85,2 +85,19 @@

/**
* Prompt for a list of items for a given `schema` and `options`.
*
* @param {Object} schema
* @param {Object} options
* @param {Function} fn
*/
exports.list = function(schema, options, fn){
var msg = format(schema, options);
prompt(msg, function(val){
var ret = val.split(/ *, */g);
if (!(ret instanceof Array)) ret = [];
return fn(ret);
});
};
/**
* Format the prompt message.

@@ -87,0 +104,0 @@ *

2

package.json

@@ -5,3 +5,3 @@ {

"repository": "git://github.com/segmentio/prompt-for.git",
"version": "0.4.1",
"version": "0.5.0",
"license": "MIT",

@@ -8,0 +8,0 @@ "main": "lib/index.js",

@@ -68,2 +68,14 @@

it('should coerce lists', function(done){
prompt({ list: 'list' }, function(err, answers){
if (err) return done(err);
assert(answers.list instanceof Array);
assert.equal(answers.list[0], 'one');
assert.equal(answers.list[1], 'two');
assert.equal(answers.list[2], 'three');
done();
});
answer('one, two, three');
});
it('should apply defaults', function(done){

@@ -70,0 +82,0 @@ prompt({ number: { type: 'number', default: 42 }}, function(err, answers){

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