prompt-actions
Advanced tools
Comparing version 1.1.0 to 1.1.1
13
index.js
@@ -24,3 +24,5 @@ 'use strict'; | ||
* Handle `number` keypress events. Toggles the choice at | ||
* corresponding row, starting at `1` (1-based index). | ||
* corresponding row, starting at `1`. Because of this (1-based index) | ||
* we need to decrement the returned position by `1`, so that | ||
* the "real" position is correct. | ||
* | ||
@@ -32,8 +34,11 @@ * @return {Number} Returns `choices.position` | ||
Actions.prototype.number = function(pos, key) { | ||
pos = key ? Number(key.value) : this.position(pos); | ||
if (key && key.hasOwnProperty('value')) { | ||
pos = Number(key.value); | ||
} | ||
pos = this.position(pos); | ||
if (pos >= 0 && pos <= this.choices.length) { | ||
this.position(--pos); | ||
this.choices.position = pos - 1; | ||
this.choices.radio(); | ||
} | ||
return pos; | ||
return pos - 1; | ||
}; | ||
@@ -40,0 +45,0 @@ |
{ | ||
"name": "prompt-actions", | ||
"description": "Action manager for prompt-base.", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"homepage": "https://github.com/enquirer/prompt-actions", | ||
@@ -23,10 +23,10 @@ "author": "Jon Schlinkert (https://github.com/jonschlinkert)", | ||
"devDependencies": { | ||
"mocha": "^3.4.1", | ||
"is-windows": "^1.0.1", | ||
"prompt-choices": "^2.0.0", | ||
"gulp": "^3.9.1", | ||
"gulp-mocha": "^3.0.1", | ||
"gulp-istanbul": "^1.1.1", | ||
"gulp-eslint": "^3.0.1", | ||
"gulp-format-md": "^0.1.12", | ||
"gulp-istanbul": "^1.1.1", | ||
"gulp-mocha": "^3.0.1", | ||
"is-windows": "^1.0.1", | ||
"mocha": "^3.4.1", | ||
"prompt-choices": "^2.0.0" | ||
"gulp-format-md": "^0.1.12" | ||
}, | ||
@@ -33,0 +33,0 @@ "keywords": [ |
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
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
9809
148