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": {
"type": "git",
"url": "git+https://github.com/ThunderNetworkRaD/std.git"
"url": "git+https://github.com/ThunderNetworkRaD/node-cin.git"
},
"keywords": [
"std",
@ -17,14 +17,18 @@
"npmjs",
"npm",
"module",
"javascript"
"javascript",
"typescript",
"input",
"cin",
"await"
],
"author": "Thunder Network RaD | Killer Boss Original",
"license": "SEE LICENSE IN LICENSE.txt",
"license": "Mozilla Public License 2.0",
"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": {
"@thundernetworkrad/readline-sync": "^2023.1.30",
"@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
*/
function cin (question: string, hide: boolean) {
export function cin (question: string, hide: boolean) {
return new Promise((resolve) => {
try {
let answer: string = readlineSync.question(`${question} `, {
@ -19,6 +19,4 @@ function cin (question: string, hide: boolean) {
return resolve('error');
}
})
};
export default cin;
};