@inquirer/input
Advanced tools
Comparing version 2.1.12 to 2.2.0
@@ -14,3 +14,3 @@ "use strict"; | ||
exports.default = (0, core_1.createPrompt)((config, done) => { | ||
const { validate = () => true } = config; | ||
const { required, validate = () => true } = config; | ||
const theme = (0, core_1.makeTheme)(config.theme); | ||
@@ -31,3 +31,3 @@ const [status, setStatus] = (0, core_1.useState)('pending'); | ||
setStatus('loading'); | ||
const isValid = yield validate(answer); | ||
const isValid = required && !answer ? 'You must provide a value' : yield validate(answer); | ||
if (isValid === true) { | ||
@@ -34,0 +34,0 @@ setValue(answer); |
@@ -6,2 +6,3 @@ import { type Theme } from '@inquirer/core'; | ||
default?: string; | ||
required?: boolean; | ||
transformer?: (value: string, { isFinal }: { | ||
@@ -8,0 +9,0 @@ isFinal: boolean; |
{ | ||
"name": "@inquirer/input", | ||
"version": "2.1.12", | ||
"version": "2.2.0", | ||
"description": "Inquirer input text prompt", | ||
@@ -57,7 +57,7 @@ "main": "./dist/cjs/index.js", | ||
"dependencies": { | ||
"@inquirer/core": "^9.0.0", | ||
"@inquirer/core": "^9.0.1", | ||
"@inquirer/type": "^1.4.0" | ||
}, | ||
"devDependencies": { | ||
"@inquirer/testing": "^2.1.24" | ||
"@inquirer/testing": "^2.1.25" | ||
}, | ||
@@ -90,3 +90,3 @@ "scripts": { | ||
"sideEffects": false, | ||
"gitHead": "fc27d575bceb96466cb8da8524c26d4eb2a77df0" | ||
"gitHead": "2285f2c043448ff4317635cf6481df7ffda2d3bd" | ||
} |
@@ -9,8 +9,25 @@ # `@inquirer/input` | ||
<table> | ||
<tr> | ||
<th>npm</th> | ||
<th>yarn</th> | ||
</tr> | ||
<tr> | ||
<td> | ||
```sh | ||
npm install @inquirer/input | ||
``` | ||
</td> | ||
<td> | ||
```sh | ||
yarn add @inquirer/input | ||
``` | ||
</td> | ||
</tr> | ||
</table> | ||
# Usage | ||
@@ -17,0 +34,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
13445
163
74
Updated@inquirer/core@^9.0.1