2023.01.28

This commit is contained in:
Killer Boss Original 2023-01-28 18:09:31 +00:00
parent cdec34ea60
commit 8718af4659
7 changed files with 38 additions and 62 deletions

48
package-lock.json generated
View file

@ -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"
}
}
}
}

View file

@ -1,6 +1,6 @@
{ {
"name": "@thundernetworkrad/std", "name": "@thundernetworkrad/std",
"version": "2023.01.26", "version": "2023.01.28",
"description": "Standard module for javascript", "description": "Standard module for javascript",
"main": "build/index.js", "main": "build/index.js",
"type": "module", "type": "module",

View file

@ -1,6 +1,11 @@
import readlineSync from '@thundernetworkrad/readline-sync'; 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) => { return new Promise((resolve) => {
try { try {
let answer: string = readlineSync.question(`${question} `, { let answer: string = readlineSync.question(`${question} `, {
@ -13,3 +18,5 @@ export default (question: string, hide: boolean) => {
} }
}) })
}; };
export default cin;

View file

@ -2,6 +2,11 @@ let debug: number, logs1: boolean|undefined|null;
import getTime from './getTime.js'; import getTime from './getTime.js';
import log from './log.js'; import log from './log.js';
export default class createCout { 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) { constructor (debugLevel: number, logs?: boolean) {
if (!debugLevel) debugLevel = 0; if (!debugLevel) debugLevel = 0;
if (!logs) logs = false; if (!logs) logs = false;
@ -9,6 +14,12 @@ export default class createCout {
logs1 = logs; logs1 = logs;
} }
/**
*
* @param string what to log?
* @param debugLevel from what debug level this will logged?
* @returns
*/
cout (string: string, debugLevel?: number) { cout (string: string, debugLevel?: number) {
if (!debugLevel) debugLevel = 0; if (!debugLevel) debugLevel = 0;
var time = getTime(); var time = getTime();

View file

@ -1,4 +1,9 @@
export default () => {
/**
*
* @returns
*/
function getTime () {
const date_time = new Date(); const date_time = new Date();
const year = date_time.getFullYear(); const year = date_time.getFullYear();
const month = parseInt(("0" + (date_time.getMonth() + 1)).slice(-2)); const month = parseInt(("0" + (date_time.getMonth() + 1)).slice(-2));
@ -8,3 +13,4 @@ export default () => {
const seconds = date_time.getSeconds(); const seconds = date_time.getSeconds();
return({year, month, day, hours, minutes, seconds}) return({year, month, day, hours, minutes, seconds})
}; };
export default getTime;

View file

@ -7,7 +7,11 @@ const startTime = getTime();
time = startTime; time = startTime;
const name = `${time.year}.${time.month}.${time.day}.${time.hours}.${time.minutes}.${time.seconds}.log`; 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 }); if (!existsSync('./logs')) mkdir('./logs', { recursive: true });
appendFile(`./logs/${name}`, string+'\n', (err: any) => { appendFile(`./logs/${name}`, string+'\n', (err: any) => {
@ -16,3 +20,5 @@ export default (string?: string) => {
} }
}) })
}; };
export default log;

View file

@ -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)