prompt-choices
Advanced tools
Comparing version 3.0.2 to 3.0.3
@@ -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._ |
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
38963
889
+ Addedpointer-symbol@^1.0.0
+ Addedpointer-symbol@1.0.0(transitive)
- Removedprompt-pointer@^1.0.0
- Removedprompt-pointer@1.0.0(transitive)