diff --git a/readme-images/example-1.png b/readme-images/example-1.png new file mode 100644 index 0000000..4e90f6d Binary files /dev/null and b/readme-images/example-1.png differ diff --git a/readme.md b/readme.md index 30164a1..91cd54f 100644 --- a/readme.md +++ b/readme.md @@ -2,14 +2,54 @@ 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 -const cin = require('cin').default; +### CommonJS -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(); ``` \ No newline at end of file