UNPKG

@tangelo/tangelo-configuration-toolkit

Version:

Tangelo Configuration Toolkit is a command-line toolkit which offers support for developing a Tangelo configuration.

28 lines (27 loc) 956 B
global._write = (...msg) => { msg = msg.map(m => typeof m == 'object' ? JSON.stringify(m, null, 2).cyan : m); console.log(msg.join(' ').replace(/^/gm, ' ')); // indent each line }; global._info = (msg, time = false) => { if (time) { const tzDiff = new Date().getTimezoneOffset() * 60000; const time = new Date(Date.now() - tzDiff).toISOString().match(/\d\d:\d\d:\d\d/)[0]; msg = `[${time}] ${msg}`; } console.log(msg.lgreen); }; global._debug = msg => { if (global._devmode) console.log(`[DEBUG]: ${msg}`.yellow); }; global._warn = msg => { console.log(msg.lyellow); }; global._error = msg => { console.log(msg.red, '\n'); process.exit(); }; global._perf = t1 => { const t2 = new Date(); console.log(`\nExecution time: ${t2 - t1}ms`.blue); }; global._formatDate = date => date?.toLocaleDateString('en-gb', {day: 'numeric', month: 'short', year: 'numeric', hour: '2-digit', minute: '2-digit'});