Readme Update
This commit is contained in:
parent
5faa1f575a
commit
7e1623296e
2 changed files with 46 additions and 6 deletions
BIN
readme-images/example-1.png
Normal file
BIN
readme-images/example-1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.2 KiB |
50
readme.md
50
readme.md
|
@ -4,12 +4,52 @@ This module allow you to make CLI in NodeJS
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
### Then
|
In this example is expected this Input/Output
|
||||||
|
|
||||||
#### CommonJS
|
![Image-1](./readme-images/example-1.png)
|
||||||
|
|
||||||
```js
|
### CommonJS
|
||||||
const cin = require('cin').default;
|
|
||||||
|
|
||||||
cin('What is your favorite food?').then(ans => console.log(ans))
|
```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();
|
||||||
```
|
```
|
Loading…
Reference in a new issue