This commit is contained in:
Killer Boss Original 2023-02-03 18:30:34 +01:00
parent f0eb8c3b50
commit 5faa1f575a
3 changed files with 26 additions and 9 deletions

View file

@ -9,7 +9,7 @@
}, },
"repository": { "repository": {
"type": "git", "type": "git",
"url": "git+https://github.com/ThunderNetworkRaD/std.git" "url": "git+https://github.com/ThunderNetworkRaD/node-cin.git"
}, },
"keywords": [ "keywords": [
"std", "std",
@ -17,14 +17,18 @@
"npmjs", "npmjs",
"npm", "npm",
"module", "module",
"javascript" "javascript",
"typescript",
"input",
"cin",
"await"
], ],
"author": "Thunder Network RaD | Killer Boss Original", "author": "Thunder Network RaD | Killer Boss Original",
"license": "SEE LICENSE IN LICENSE.txt", "license": "Mozilla Public License 2.0",
"bugs": { "bugs": {
"url": "https://github.com/ThunderNetworkRaD/std/issues" "url": "https://github.com/ThunderNetworkRaD/node-cin/issues"
}, },
"homepage": "https://github.com/ThunderNetworkRaD/std#readme", "homepage": "https://github.com/ThunderNetworkRaD/node-cin#readme",
"dependencies": { "dependencies": {
"@thundernetworkrad/readline-sync": "^2023.1.30", "@thundernetworkrad/readline-sync": "^2023.1.30",
"@types/node": "^18.11.18", "@types/node": "^18.11.18",

View file

@ -0,0 +1,15 @@
# CIN
This module allow you to make CLI in NodeJS
##Examples
### Then
#### CommonJS
```js
const cin = require('cin').default;
cin('What is your favorite food?').then(ans => console.log(ans))
```

View file

@ -7,7 +7,7 @@ import readlineSync from '@thundernetworkrad/readline-sync';
* @returns * @returns
*/ */
function cin (question: string, hide: boolean) { export function cin (question: string, hide: boolean) {
return new Promise((resolve) => { return new Promise((resolve) => {
try { try {
let answer: string = readlineSync.question(`${question} `, { let answer: string = readlineSync.question(`${question} `, {
@ -20,5 +20,3 @@ function cin (question: string, hide: boolean) {
} }
}) })
}; };
export default cin;