enquirer
Advanced tools
Comparing version 2.0.9 to 2.1.0
@@ -35,17 +35,14 @@ # Release history | ||
## 2.1.0 - 2018-11-29 | ||
## 3.0.0 - 2018-11-14 | ||
### Fixed | ||
- `validate` function now properly accepts `false` as a return value, thanks to [@g-plane](https://github.com/g-plane). | ||
- Several improvements were made for handling custom `format`, `result` and `initial` functions defined on the options. | ||
### Removed | ||
## 2.0.7 - 2018-11-14 | ||
- `hSelect` and `hMultiSelect` (horizontal select and multiselect) have been removed and moved over to the [recipes](recipes) folder. If you need these prompts and want to see how to re-create the functionality, you will find examples in [recipes/examples](recipes/examples). | ||
### Fixed | ||
### Changed | ||
- `validate` function now properly accepts `false` as a return value, thanks to [@g-plane](https://github.com/g-plane). | ||
- `ctrl+d` is now mapped to `deleteForward` instead of `cancel`. | ||
### Added | ||
@@ -52,0 +49,0 @@ |
10
index.js
@@ -168,4 +168,7 @@ 'use strict'; | ||
set Prompt(value) { | ||
this._Prompt = value; | ||
} | ||
get Prompt() { | ||
return this.constructor.Prompt; | ||
return this._Prompt || this.constructor.Prompt; | ||
} | ||
@@ -177,4 +180,7 @@ | ||
static set Prompt(value) { | ||
this._Prompt = value; | ||
} | ||
static get Prompt() { | ||
return require('./lib/prompt'); | ||
return this._Prompt || require('./lib/prompt'); | ||
} | ||
@@ -181,0 +187,0 @@ |
@@ -39,2 +39,3 @@ 'use strict'; | ||
async keypress(char, event = {}) { | ||
this.keypressed = true; | ||
let key = keypress.action(char, keypress(char, event), this.options.actions); | ||
@@ -173,2 +174,7 @@ this.state.keypress = key; | ||
async initialize() { | ||
let { format, result } = this; | ||
this.format = () => format.call(this, this.value); | ||
this.result = () => result.call(this, this.value); | ||
if (typeof this.options.initial === 'function') { | ||
@@ -175,0 +181,0 @@ this.initial = await this.options.initial.call(this); |
@@ -12,2 +12,3 @@ 'use strict'; | ||
format(input = this.input) { | ||
if (!this.keypressed) return ''; | ||
let color = this.state.submitted ? this.styles.primary : this.styles.muted; | ||
@@ -14,0 +15,0 @@ return color(this.symbols.asterisk.repeat(input.length)); |
@@ -555,2 +555,12 @@ 'use strict'; | ||
set value(value) { | ||
super.value = value; | ||
} | ||
get value() { | ||
if (typeof super.value !== 'string' && super.value === this.initial) { | ||
return this.input; | ||
} | ||
return super.value; | ||
} | ||
set index(i) { | ||
@@ -557,0 +567,0 @@ this.state.index = i; |
{ | ||
"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.0.9", | ||
"version": "2.1.0", | ||
"homepage": "https://github.com/enquirer/enquirer", | ||
@@ -6,0 +6,0 @@ "author": "Jon Schlinkert (https://github.com/jonschlinkert)", |
@@ -296,3 +296,3 @@ <h1 align="center">Enquirer</h1> | ||
### [Enquirer#prompt](index.js#L207) | ||
### [Enquirer#prompt](index.js#L213) | ||
@@ -1116,5 +1116,5 @@ Prompt function that takes a "question" object or array of question objects, and returns an object with responses from the user. | ||
| --- | --- | | ||
| 238 | [jonschlinkert](https://github.com/jonschlinkert) | | ||
| 24 | [doowb](https://github.com/doowb) | | ||
| 8 | [g-plane](https://github.com/g-plane) | | ||
| 255 | [jonschlinkert](https://github.com/jonschlinkert) | | ||
| 25 | [doowb](https://github.com/doowb) | | ||
| 15 | [g-plane](https://github.com/g-plane) | | ||
| 3 | [tunnckoCore](https://github.com/tunnckoCore) | | ||
@@ -1128,2 +1128,3 @@ | 2 | [DanielRuf](https://github.com/DanielRuf) | | ||
| 1 | [mischah](https://github.com/mischah) | | ||
| 1 | [renarsvilnis](https://github.com/renarsvilnis) | | ||
| 1 | [sbugert](https://github.com/sbugert) | | ||
@@ -1130,0 +1131,0 @@ | 1 | [skellock](https://github.com/skellock) | |
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
180212
3796
1145
3