Comparing version 0.2.3 to 0.2.4
@@ -421,10 +421,7 @@ /* | ||
if (prompt.override && prompt.override[propName]) { | ||
var isValid = prompt._performValidation(name, prop, prompt.override, schema, -1, callback); | ||
if(isValid){ | ||
if (prompt._performValidation(name, prop, prompt.override, schema, -1, callback)) { | ||
return callback(null, prompt.override[propName]); | ||
}else{ | ||
delete prompt.override[propName]; | ||
} | ||
delete prompt.override[propName]; | ||
} | ||
@@ -478,3 +475,3 @@ | ||
if(!isValid){ | ||
if (!isValid) { | ||
return prompt.getInput(prop, callback); | ||
@@ -504,4 +501,3 @@ } | ||
// | ||
prompt._performValidation = function(name, prop, against, schema, line, callback){ | ||
prompt._performValidation = function (name, prop, against, schema, line, callback) { | ||
var valid, msg; | ||
@@ -517,3 +513,2 @@ | ||
if (!valid.valid) { | ||
msg = line !== -1 ? 'Invalid input for ' : 'Invalid command-line input for '; | ||
@@ -520,0 +515,0 @@ |
{ | ||
"name": "prompt", | ||
"description": "A beautiful command-line prompt for node.js", | ||
"version": "0.2.3", | ||
"version": "0.2.4", | ||
"author": "Nodejitsu Inc. <info@nodejitsu.com>", | ||
@@ -16,3 +16,3 @@ "maintainers": [ | ||
"pkginfo": "0.x.x", | ||
"read": "0.1.x", | ||
"read": "1.0.x", | ||
"revalidator": "0.1.x", | ||
@@ -19,0 +19,0 @@ "utile": "0.1.x", |
@@ -121,6 +121,13 @@ /* | ||
fnvalidator: { | ||
name: 'fnvalidator', | ||
validator: function (line) { | ||
return line.slice(0,2) == 'fn'; | ||
}, | ||
message: 'fnvalidator must start with "fn"' | ||
}, | ||
fnconform: { | ||
conform: function (line) { | ||
return line.slice(0,2) == 'fn'; | ||
}, | ||
message: 'fnvalidator must start with "fn"' | ||
message: 'fnconform must start with "fn"' | ||
}/*, | ||
@@ -127,0 +134,0 @@ cbvalidator: { |
@@ -171,3 +171,12 @@ /* | ||
topic: function () { | ||
prompt.getInput(grab('badValidator'), this.callback); | ||
var that = this, | ||
called; | ||
prompt.getInput(grab('badValidator'), function (err) { | ||
if (!called) { | ||
called = true; | ||
that.callback(err); | ||
} | ||
}); | ||
helpers.stdin.writeNextTick('some-user\n'); | ||
}, | ||
@@ -235,3 +244,3 @@ "should respond with an error": function (err, ign) { | ||
}, | ||
"with a sync function validator": { | ||
"with a sync function validator (.validator)": { | ||
topic: function () { | ||
@@ -244,3 +253,3 @@ var that = this; | ||
prompt.get(grab('fnvalidator'), this.callback); | ||
prompt.get(helpers.schema.properties.fnvalidator, this.callback); | ||
helpers.stdin.writeNextTick('fn123\n'); | ||
@@ -252,2 +261,18 @@ }, | ||
} | ||
}, | ||
"with a sync function validator (.conform)": { | ||
topic: function () { | ||
var that = this; | ||
helpers.stdout.once('data', function (msg) { | ||
that.msg = msg; | ||
}); | ||
prompt.get(grab('fnconform'), this.callback); | ||
helpers.stdin.writeNextTick('fn123\n'); | ||
}, | ||
"should accept a value that is checked": function (err, result) { | ||
assert.isNull(err); | ||
assert.equal(result['fnconform'],'fn123'); | ||
} | ||
} | ||
@@ -254,0 +279,0 @@ // |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Non-existent author
Supply chain riskThe package was published by an npm account that no longer exists.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
112779
1936
1
+ Addedmute-stream@0.0.8(transitive)
+ Addedread@1.0.7(transitive)
- Removedread@0.1.1(transitive)
Updatedread@1.0.x