var Choices = require('{%= name %}');
var choices = new Choices(['foo', 'bar', 'baz']);{%= apidocs("index.js") %}
Added
- adds array support to
.isChecked
Fixed
- ensures that choice groups are checked/unchecked based on group items
Added
- adds support for choice "groups"! This allows you to define an object of choice arrays, where each key in the object creates a choice group.
Changed
- renamed
Moveclass toActions - renamed
choices.moveproperty tochoices.actions
Removed
- removed
.enableand.disableprototype methods from bothChoiceandChoices. These methods were ambiguous as they blurred the distinction between "enabling" a choice (meaning that it's "checked") versus enabling a property on a choice. If this is confusing, that's why they were removed.
Added
- adds
Actionsclass (previously namedMove) for managing actions on choices - adds
.addChoiceprototype method, for adding a single choice after instantiation - adds
.actionprototype method toChoices, which calls a method on theActionsclass - adds
.checkand.uncheckprototype methods (previously ambiguously named.enableand.disable)
Some of the code in this library was initially based on the Choices class in Inquirer.