Security News
JSR Working Group Kicks Off with Ambitious Roadmap and Plans for Open Governance
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Generate an inquirer choices question from an array.
Install with npm
$ npm i to-choices --save
var toChoices = require('to-choices');
var question = toChoices('foo', ['a', 'b', 'c']);
console.log(question);
Results in:
{ type: 'checkbox',
name: 'foo',
message: 'foo',
choices:
[ { name: 'all', value: ['a', 'b', 'c'] },
{ type: 'separator', line: '\u001b[90m————\u001b[39m' },
{ name: 'a' },
{ name: 'b' },
{ name: 'c' } ] }
See the inquirer documentation for more details about question objects and supported properties.
Create a question object with the given name
and array of choices
.
Params
name
{String|Object}: Name of the question or object with a name
property.options
{Object|Array}: Question options or array of choices. If an array of choices is specified, the name will be used as the message
.returns
{Object}Example
toChoices(name[, options]);
Install dev dependencies:
$ npm i -d && npm test
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Jon Schlinkert
Copyright © 2015 Jon Schlinkert Released under the MIT license.
This file was generated by verb-cli on November 29, 2015.
FAQs
Easily create a normalized inquirer choices question. Supports all of the `choices` question types: checkbox, list, rawlist, expand
The npm package to-choices receives a total of 20,045 weekly downloads. As such, to-choices popularity was classified as popular.
We found that to-choices demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Security News
Research
An advanced npm supply chain attack is leveraging Ethereum smart contracts for decentralized, persistent malware control, evading traditional defenses.
Security News
Research
Attackers are impersonating Sindre Sorhus on npm with a fake 'chalk-node' package containing a malicious backdoor to compromise developers' projects.