https://github.com/iansu/node-prompts
A POC of a Node.js implementation of the Web APIs for alert, confirm and prompt
https://github.com/iansu/node-prompts
Last synced: about 2 months ago
JSON representation
A POC of a Node.js implementation of the Web APIs for alert, confirm and prompt
- Host: GitHub
- URL: https://github.com/iansu/node-prompts
- Owner: iansu
- Created: 2023-02-20T22:54:13.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-02-20T22:59:24.000Z (about 2 years ago)
- Last Synced: 2025-01-26T06:44:52.742Z (4 months ago)
- Language: JavaScript
- Size: 1000 Bytes
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Node Prompts
A POC of a Node.js implementation of the Web APIs for alert, confirm and prompt
## Usage
### Alert
```js
await alert('Please confirm');
```### Confirm
```js
const result = await confirm('Are you sure?');if (result) {
// do something
}
```### Prompt
```js
// prompt with no default value
const result = await prompt('What is your name?');
console.log(result);// prompt with a default value
const resultWithDefault = await prompt('What is your age?', 18);
console.log(resultWithDefault);
```