From 8718af46594f7710e78a5b71fe9a595636f2dbdb Mon Sep 17 00:00:00 2001 From: Killer Boss Original <73131550+killerbossoriginal@users.noreply.github.com> Date: Sat, 28 Jan 2023 18:09:31 +0000 Subject: [PATCH] 2023.01.28 --- package-lock.json | 48 ----------------------------------------------- package.json | 2 +- src/cin.ts | 13 ++++++++++--- src/cout.ts | 11 +++++++++++ src/getTime.ts | 10 ++++++++-- src/log.ts | 10 ++++++++-- test.js | 6 ------ 7 files changed, 38 insertions(+), 62 deletions(-) delete mode 100644 package-lock.json delete mode 100644 test.js diff --git a/package-lock.json b/package-lock.json deleted file mode 100644 index d25aa46..0000000 --- a/package-lock.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "name": "@thundernetworkrad/std", - "version": "2023.01.26", - "lockfileVersion": 3, - "requires": true, - "packages": { - "": { - "name": "@thundernetworkrad/std", - "version": "2023.01.26", - "hasInstallScript": true, - "license": "SEE LICENSE IN LICENSE.txt", - "dependencies": { - "@thundernetworkrad/readline-sync": "^2023.1.26-2" - }, - "devDependencies": { - "@types/node": "^18.11.18", - "typescript": "^4.9.4" - } - }, - "node_modules/@thundernetworkrad/readline-sync": { - "version": "2023.1.26-2", - "resolved": "https://registry.npmjs.org/@thundernetworkrad/readline-sync/-/readline-sync-2023.1.26-2.tgz", - "integrity": "sha512-m07hRMV5evmgbbAMD7hk8yX8Cv2yLj92aZtbC9iEtu5YQ9DRwPvyXmdtHutHI6DYHGs/kGDmjzUfQpJyowsZXA==", - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/@types/node": { - "version": "18.11.18", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.18.tgz", - "integrity": "sha512-DHQpWGjyQKSHj3ebjFI/wRKcqQcdR+MoFBygntYOZytCqNfkd2ZC4ARDJ2DQqhjH5p85Nnd3jhUJIXrszFX/JA==", - "dev": true - }, - "node_modules/typescript": { - "version": "4.9.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.4.tgz", - "integrity": "sha512-Uz+dTXYzxXXbsFpM86Wh3dKCxrQqUcVMxwU54orwlJjOpO3ao8L7j5lH+dWfTwgCwIuM9GQ2kvVotzYJMXTBZg==", - "dev": true, - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=4.2.0" - } - } - } -} diff --git a/package.json b/package.json index 9442000..99ca050 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@thundernetworkrad/std", - "version": "2023.01.26", + "version": "2023.01.28", "description": "Standard module for javascript", "main": "build/index.js", "type": "module", diff --git a/src/cin.ts b/src/cin.ts index eb406c7..d505064 100644 --- a/src/cin.ts +++ b/src/cin.ts @@ -1,6 +1,11 @@ import readlineSync from '@thundernetworkrad/readline-sync'; - -export default (question: string, hide: boolean) => { +/** + * + * @param question what question you need to make? + * @param hide is the question private? + * @returns + */ +function cin (question: string, hide: boolean) { return new Promise((resolve) => { try { let answer: string = readlineSync.question(`${question} `, { @@ -12,4 +17,6 @@ export default (question: string, hide: boolean) => { return resolve('error'); } }) -}; \ No newline at end of file +}; + +export default cin; \ No newline at end of file diff --git a/src/cout.ts b/src/cout.ts index c0a538a..ccb5cd6 100644 --- a/src/cout.ts +++ b/src/cout.ts @@ -2,6 +2,11 @@ let debug: number, logs1: boolean|undefined|null; import getTime from './getTime.js'; import log from './log.js'; export default class createCout { + /** + * @constructor + * @param debugLevel from what debug level you want to log? + * @param logs do you want files log? + */ constructor (debugLevel: number, logs?: boolean) { if (!debugLevel) debugLevel = 0; if (!logs) logs = false; @@ -9,6 +14,12 @@ export default class createCout { logs1 = logs; } + /** + * + * @param string what to log? + * @param debugLevel from what debug level this will logged? + * @returns + */ cout (string: string, debugLevel?: number) { if (!debugLevel) debugLevel = 0; var time = getTime(); diff --git a/src/getTime.ts b/src/getTime.ts index a47dc33..a285f61 100644 --- a/src/getTime.ts +++ b/src/getTime.ts @@ -1,4 +1,9 @@ -export default () => { + +/** + * + * @returns + */ +function getTime () { const date_time = new Date(); const year = date_time.getFullYear(); const month = parseInt(("0" + (date_time.getMonth() + 1)).slice(-2)); @@ -7,4 +12,5 @@ export default () => { const minutes = date_time.getMinutes(); const seconds = date_time.getSeconds(); return({year, month, day, hours, minutes, seconds}) -}; \ No newline at end of file +}; +export default getTime; \ No newline at end of file diff --git a/src/log.ts b/src/log.ts index 9aeb2e6..4471a49 100644 --- a/src/log.ts +++ b/src/log.ts @@ -7,7 +7,11 @@ const startTime = getTime(); time = startTime; const name = `${time.year}.${time.month}.${time.day}.${time.hours}.${time.minutes}.${time.seconds}.log`; -export default (string?: string) => { +/** + * + * @param string to log + */ +function log (string?: string) { if (!existsSync('./logs')) mkdir('./logs', { recursive: true }); appendFile(`./logs/${name}`, string+'\n', (err: any) => { @@ -15,4 +19,6 @@ export default (string?: string) => { throw err } }) -}; \ No newline at end of file +}; + +export default log; \ No newline at end of file diff --git a/test.js b/test.js deleted file mode 100644 index a189b95..0000000 --- a/test.js +++ /dev/null @@ -1,6 +0,0 @@ -import thunder from './build/index.js'; - -let cout = new thunder.cout(0, true) -cout.cout(thunder.getTime()); - -cout.cout('ciao', 0) \ No newline at end of file