This repo is meant to be up-to-date, providing type-safety and synchronous & asynchronous functions to make development for your projects much easier.
- Console Progress
To-Be-Completed as updates roll-out.
import {tools} from "useful-functions-ts";
tools.delay();
tools.formatNumber();
// etc.
import {delay} from "useful-functions-ts";
await delay(1000); // Wait for 1000 milliseconds
import {formatNumber} from "useful-functions-ts";
formatNumber(192874.24, 'en'); // Returns 192,874.24
formatNumber(192874.24, 'de'); // Returns 192.874,24
import {percentage} from "useful-functions-ts";
percentage(1, 100); // Returns 1%
import {Logger} from 'useful-functions-ts'
const logger = new Logger("Main Process", {
outputFile?: boolean, // Save output to file
filePath?: string, // relative or absolute to folder
outputJson?: boolean, // Be able to access the outputs as json with logger.getOutput()
}); // These settings are optional
logger.info("This is info");
logger.log("Simple log");
logger.warn("A warning");
logger.error("An error occured");
logger.success("Succeeded!");
logger.debug("Debug info");
logger.getOutput() // Get JSON console output if option enabled
logger.clearOutput() // Clear the JSON console output