Comparing version 2.3.3 to 2.3.4
@@ -48,2 +48,12 @@ # Release history | ||
## 2.3.4 - 2020-01-13 | ||
### Added | ||
- `MultiSelectPrompt` new example for `result` option. | ||
### Fixed | ||
- Updated typings to use `EventEmitter` class from `events` directly due to changes in `@types/node`. | ||
## 2.3.2 - 2019-09-17 | ||
@@ -50,0 +60,0 @@ |
@@ -0,1 +1,3 @@ | ||
import { EventEmitter } from "events"; | ||
interface BasePromptOptions { | ||
@@ -92,3 +94,3 @@ name: string | (() => string) | ||
declare class BasePrompt extends NodeJS.EventEmitter { | ||
declare class BasePrompt extends EventEmitter { | ||
constructor(options?: PromptOptions); | ||
@@ -101,3 +103,3 @@ | ||
declare class Enquirer<T = object> extends NodeJS.EventEmitter { | ||
declare class Enquirer<T = object> extends EventEmitter { | ||
constructor(options?: object, answers?: T); | ||
@@ -104,0 +106,0 @@ |
{ | ||
"name": "enquirer", | ||
"description": "Stylish, intuitive and user-friendly prompt system. Fast and lightweight enough for small projects, powerful and extensible enough for the most advanced use cases.", | ||
"version": "2.3.3", | ||
"version": "2.3.4", | ||
"homepage": "https://github.com/enquirer/enquirer", | ||
@@ -6,0 +6,0 @@ "author": "Jon Schlinkert (https://github.com/jonschlinkert)", |
@@ -727,4 +727,47 @@ <h1 align="center">Enquirer</h1> | ||
.catch(console.error); | ||
// Answer: ['aqua', 'blue', 'fuchsia'] | ||
``` | ||
**Example key-value pairs** | ||
Optionally, pass a `result` function and use the `.map` method to return an object of key-value pairs of the selected names and values: [example](./examples/multiselect/option-result.js) | ||
```js | ||
const { MultiSelect } = require('enquirer'); | ||
const prompt = new MultiSelect({ | ||
name: 'value', | ||
message: 'Pick your favorite colors', | ||
limit: 7, | ||
choices: [ | ||
{ name: 'aqua', value: '#00ffff' }, | ||
{ name: 'black', value: '#000000' }, | ||
{ name: 'blue', value: '#0000ff' }, | ||
{ name: 'fuchsia', value: '#ff00ff' }, | ||
{ name: 'gray', value: '#808080' }, | ||
{ name: 'green', value: '#008000' }, | ||
{ name: 'lime', value: '#00ff00' }, | ||
{ name: 'maroon', value: '#800000' }, | ||
{ name: 'navy', value: '#000080' }, | ||
{ name: 'olive', value: '#808000' }, | ||
{ name: 'purple', value: '#800080' }, | ||
{ name: 'red', value: '#ff0000' }, | ||
{ name: 'silver', value: '#c0c0c0' }, | ||
{ name: 'teal', value: '#008080' }, | ||
{ name: 'white', value: '#ffffff' }, | ||
{ name: 'yellow', value: '#ffff00' } | ||
], | ||
result(names) { | ||
return this.map(names); | ||
} | ||
}); | ||
prompt.run() | ||
.then(answer => console.log('Answer:', answer)) | ||
.catch(console.error); | ||
// Answer: { aqua: '#00ffff', blue: '#0000ff', fuchsia: '#ff00ff' } | ||
``` | ||
**Related prompts** | ||
@@ -1667,3 +1710,3 @@ | ||
| 283 | [jonschlinkert](https://github.com/jonschlinkert) | | ||
| 66 | [doowb](https://github.com/doowb) | | ||
| 72 | [doowb](https://github.com/doowb) | | ||
| 32 | [rajat-sr](https://github.com/rajat-sr) | | ||
@@ -1675,6 +1718,7 @@ | 20 | [318097](https://github.com/318097) | | ||
| 3 | [tunnckoCore](https://github.com/tunnckoCore) | | ||
| 3 | [sw-yx](https://github.com/sw-yx) | | ||
| 2 | [adityavyas611](https://github.com/adityavyas611) | | ||
| 2 | [DanielRuf](https://github.com/DanielRuf) | | ||
| 2 | [gabel0287](https://github.com/gabel0287) | | ||
| 2 | [sw-yx](https://github.com/sw-yx) | | ||
| 1 | [AlCalzone](https://github.com/AlCalzone) | | ||
| 1 | [ImgBotApp](https://github.com/ImgBotApp) | | ||
@@ -1681,0 +1725,0 @@ | 1 | [jsonkao](https://github.com/jsonkao) | |
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
196610
4199
1747