node-cin/readme.md

55 lines
883 B
Markdown
Raw Permalink Normal View History

2023-02-03 18:30:34 +01:00
# CIN
This module allow you to make CLI in NodeJS
2023-02-03 18:43:26 +01:00
## Examples
2023-02-03 18:30:34 +01:00
2023-02-03 18:43:26 +01:00
In this example is expected this Input/Output
2023-02-03 18:30:34 +01:00
2023-02-03 18:43:26 +01:00
![Image-1](./readme-images/example-1.png)
2023-02-03 18:30:34 +01:00
2023-02-03 18:43:26 +01:00
### CommonJS
2023-02-03 18:30:34 +01:00
2023-02-03 18:43:26 +01:00
```cjs
const { cin } = require('cin');
cin('What is your favorite food?').then(ans => console.log(ans));
// or
async function hello() {
var ans = await cin('What is your favorite food?');
console.log(ans);
}
hello();
```
### ModuleJS
```mjs
import { cin } from 'cin';
cin('What is your favorite food?').then(ans => console.log(ans));
// or
async function hello() {
var ans = await cin('What is your favorite food?');
console.log(ans);
}
hello();
```
### TypeScript
```ts
import { cin } from 'cin';
cin('What is your favorite food?').then(ans => console.log(ans));
// or
async function hello() {
var ans = await cin('What is your favorite food?');
console.log(ans);
}
hello();
2023-02-03 18:30:34 +01:00
```