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

prompt-actions

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

prompt-actions - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

49

index.js

@@ -30,8 +30,9 @@ 'use strict';

Actions.prototype.number = function(pos) {
if (pos <= this.choices.length && pos >= 0) {
this.choices.position = pos - 1;
Actions.prototype.number = function(pos, key) {
pos = key ? Number(key.value) : this.position(pos);
if (pos >= 0 && pos <= this.choices.length) {
this.position(--pos);
this.choices.radio();
}
return pos - 1;
return pos;
};

@@ -48,2 +49,3 @@

Actions.prototype.space = function(pos) {
pos = this.position(pos);
this.choices.radio();

@@ -75,3 +77,3 @@ return pos;

Actions.prototype.tab = function(pos) {
return pos;
return this.position(pos);
};

@@ -88,6 +90,6 @@

Actions.prototype.a = function() {
Actions.prototype.a = function(pos) {
this.choices[this.choices.all ? 'uncheck' : 'check']();
this.choices.update();
return this.choices.position;
return this.position(pos);
};

@@ -101,5 +103,6 @@

Actions.prototype.i = function() {
Actions.prototype.i = function(pos) {
this.choices.toggle();
return this.choices.position;
this.choices.update();
return this.position(pos);
};

@@ -114,3 +117,4 @@

Actions.prototype.down = function(pos) {
Actions.prototype.down = function(pos, key) {
pos = this.position(pos);
return (pos < this.choices.length - 1) ? pos + 1 : 0;

@@ -126,3 +130,4 @@ };

Actions.prototype.up = function(pos) {
Actions.prototype.up = function(pos, key) {
pos = this.position(pos);
return (pos > 0) ? pos - 1 : this.choices.length - 1;

@@ -141,7 +146,25 @@ };

Actions.prototype.enter = function(pos) {
return pos;
Actions.prototype.enter = function(pos, key) {
return this.position(pos);
};
/**
* Helper for getting the current position.
*
* @param {Number} `pos` (optional) Current position
* @return {Number} Returns given `pos` or `choices.position`
* @api public
*/
Actions.prototype.position = function(pos) {
if (typeof pos === 'number') {
if (pos >= 0 && pos <= this.choices.length) {
this.choices.position = pos;
}
return pos;
}
return this.choices.position;
};
/**
* Expose `Actions`

@@ -148,0 +171,0 @@ */

{
"name": "prompt-actions",
"description": "Action manager for prompt-base.",
"version": "1.0.0",
"version": "1.1.0",
"homepage": "https://github.com/enquirer/prompt-actions",

@@ -6,0 +6,0 @@ "author": "Jon Schlinkert (https://github.com/jonschlinkert)",

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