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 1.0.0 to 1.1.0

5

History.md
1.1.0 - March 29, 2015
----------------------
* add `prefix` option
* swap to `read` for prompting
1.0.0 - March 28, 2015

@@ -3,0 +8,0 @@ ----------------------

23

lib/types.js

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

var fmt = require('util').format;
var prompt = require('cli-prompt');
var read = require('read');
var colors = chalk.styles;

@@ -19,3 +19,4 @@

var msg = format(schema, options);
prompt(msg, function(val){
read({ prompt: msg }, function(err, val){
if (err) return fn();
if ('' === val && schema.required) return fn();

@@ -36,3 +37,4 @@ return fn(val);

var msg = format(schema, options);
prompt.password(msg, function(val){
read({ prompt: msg, silent: true }, function(err, val){
if (err) return fn([]);
if ('' === val && schema.required) return fn();

@@ -53,3 +55,4 @@ return fn(val);

var msg = format(schema, options);
prompt(msg, function(val){
read({ prompt: msg }, function(err, val){
if (err) return fn([]);
val = parseFloat(val, 10);

@@ -71,3 +74,4 @@ if (isNaN(val)) return fn();

var msg = format(schema, options);
prompt(msg, function(val){
read({ prompt: msg }, function(err, val){
if (err) return fn([]);
if ('' == val) return fn();

@@ -88,3 +92,4 @@ fn(/^(y|yes|true)$/i.test(val));

var msg = format(schema, options);
prompt(msg, function(val){
read({ prompt: msg }, function(err, val){
if (err) return fn([]);
var ret = new Date(val);

@@ -106,3 +111,4 @@ if (invalid(ret)) ret = date(val);

var msg = format(schema, options);
prompt(msg, function(val){
read({ prompt: msg }, function(err, val){
if (err) return fn([]);
var ret = val.split(/ *, */g);

@@ -124,6 +130,7 @@ if (!(ret instanceof Array)) ret = [];

var sep = options.separator || ':';
var prefix = options.prefix || '';
var label = color in colors ? chalk[color](schema.label) : schema.label;
var help = hint(schema);
var h = help ? chalk.gray(help) + ' ' : '';
return fmt('%s%s %s', label, sep, h);
return fmt('%s%s %s', prefix, label, sep, h);
}

@@ -130,0 +137,0 @@

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

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

@@ -18,3 +18,4 @@ "main": "lib/index.js",

"max-component": "^1.0.0",
"pad-component": "0.0.1"
"pad-component": "0.0.1",
"read": "^1.0.5"
},

@@ -21,0 +22,0 @@ "devDependencies": {

@@ -99,3 +99,5 @@

color: null,
pad: true
pad: true,
prefix: '',
separator: ': '
}

@@ -102,0 +104,0 @@

Sorry, the diff of this file is not supported yet

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