Printly.js is the rewrite of console objects in JavaScript and much better then console object and Printly.js has colours support on console messages.
Printly.js has TypeScript and JavaScript supoort.
- 1
printly();
for printing a console message. - 2
printly.error();
outputs an error message to the Web console. - 3
printly.warn();
outputs a warning message to the Web console. - 4
printly.data();
utilize small spaces to not only function as additional storage, but to also show off some of your home decor and personality. - 5
printly.clear();
clears the console if the console allows it. - 6
printly.count();
logs the number of times that this particular call to count() has been called. - 7
printly.dir();
displays an interactive list of the properties of the specified JavaScript object. - 8
printly.time();
starts a timer you can use to track how long an operation takes. - 9
printly.timeEnd();
stops a timer that was previously started by calling console. - 10
printly.timeout();
it's basically setTimeout but easy
Here is a example with printly objects.
const { printly } = require("printly.js");
printly("Hello Printly.js!");
Here is a example with colours and some background colours.
// you can use colour or color if you want!
const { printly, colour } = require("printly.js");
printly(colour.yellow("Hello Printly.js with colour!"));
printly(colour.bgCyan(colour.red("Hello background colour"));
And here is a example with printly.timeout.
const { printly, colour } = require("printly.js");
printly(colour.yellow("Hello Printly.js"));
printly(colour.bgCyan(colour.red("Hello background colour"));
// by default is printly(); on first argument
printly.timeout(("Hello printly.js after 4 seconds"), 4000);
// example with colour
printly.timeout(colour.cyan("Hello printly.js after 4 seconds"), 4000);
And here is the millisecond converter.
const { printly, ms } = require("printly.js");
ms('1d') // 86400000
ms('10h') // 36000000
ms('2h') // 7200000
ms('1m') // 60000
ms('5s') // 5000
ms('100') // 100
ms(100) // 100
ms(60000) // "1 minute"
ms(2 * 60000) // "2 minutes"
printly.timeout(("Hello Printly.js"), ms('10 hours')); // "10 hours"
Foreground | Background | |
---|---|---|
black | bgBlack | |
red | bgRed | |
green | bgGreen | |
yellow | bgYellow | |
blue | bgBlue | |
magenta | bgMagenta | |
cyan | bgCyan | |
white | bgWhite |
Not supported on Windows and some terminals. However if used in not supported environment, the closest color from basic (16 colors) palette is chosen.
thats it hope it will help JavaScript and TypeScript developers!