Socket
Socket
Sign inDemoInstall

prompt-choices

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

prompt-choices - npm Package Compare versions

Comparing version 3.0.2 to 3.0.3

32

lib/choice.js

@@ -6,3 +6,3 @@ 'use strict';

var define = require('define-property');
var pointer = require('prompt-pointer');
var pointer = require('pointer-symbol');
var radio = require('radio-symbol');

@@ -119,25 +119,35 @@ var strip = require('strip-color');

/**
* Getter for getting the checkbox or radio symbol to use.
* @name .symbol
* Getter for getting the current state of the choice. States
* are `on`, `off` and `disabled`.
* @name .state
* @api public
*/
Object.defineProperty(Choice.prototype, 'symbol', {
Object.defineProperty(Choice.prototype, 'state', {
set: function() {
throw new Error('.symbol is a getter and cannot be defined');
throw new Error('.state is a getter and cannot be defined');
},
get: function() {
return (this.options.checkbox || radio)[this.state];
if (this.disabled) {
return 'disabled';
}
return this.checked ? 'on' : 'off';
}
});
Object.defineProperty(Choice.prototype, 'state', {
/**
* Getter for getting the checkbox or radio symbol to use.
* @name .symbol
* @api public
*/
Object.defineProperty(Choice.prototype, 'symbol', {
set: function() {
throw new Error('.state is a getter and cannot be defined');
throw new Error('.symbol is a getter and cannot be defined');
},
get: function() {
if (this.disabled) {
return 'disabled';
if (this.options.checkbox === false) {
return '';
}
return this.checked ? 'on' : 'off';
return (this.options.checkbox || radio)[this.state];
}

@@ -144,0 +154,0 @@ });

{
"name": "prompt-choices",
"description": "Create an array of multiple choice objects for use in prompts.",
"version": "3.0.2",
"version": "3.0.3",
"homepage": "https://github.com/enquirer/prompt-choices",

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

"log-utils": "^0.2.1",
"prompt-pointer": "^1.0.0",
"pointer-symbol": "^1.0.0",
"radio-symbol": "^2.0.0",

@@ -38,0 +38,0 @@ "set-value": "^1.0.0",

@@ -462,2 +462,2 @@ # prompt-choices [![NPM version](https://img.shields.io/npm/v/prompt-choices.svg?style=flat)](https://www.npmjs.com/package/prompt-choices) [![NPM monthly downloads](https://img.shields.io/npm/dm/prompt-choices.svg?style=flat)](https://npmjs.org/package/prompt-choices) [![NPM total downloads](https://img.shields.io/npm/dt/prompt-choices.svg?style=flat)](https://npmjs.org/package/prompt-choices) [![Linux Build Status](https://img.shields.io/travis/enquirer/prompt-choices.svg?style=flat&label=Travis)](https://travis-ci.org/enquirer/prompt-choices)

_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on May 21, 2017._
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on May 23, 2017._
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