Joined February 2013
·

Szymon Wygnański

Chełmno
·
·

Thx a lot!
I've used it to make my logs look better:

/**
 * Does console.log and formats the data a nice way
 * @param {any[]} ...args
 */
function log() {
    var args = Array.prototype.slice.call(arguments);
    var logToWrite = args.map(function (arg) {
        var str;
        var argType = typeof arg;

        if (arg === null) {
            str = 'null';
        } else if (arg === undefined) {
            str = '';
        } else if (!arg.toString || arg.toString() === '[object Object]') {
            str = JSON.stringify(arg, null, '  ');
        } else if (argType === 'string') {
            str = '"' + arg.toString() + '"';
        } else {
            str = arg.toString();
        }

        return '\x1b[36m<\x1b[0m' + str + '\x1b[36m>\x1b[0m';
    }).join(', ');
    console.log(logToWrite);
}
Posted to Sublime Select All in a Bracket over 1 year ago

On Linux it's: ctrl+shift+m

Achievements
78 Karma
0 Total ProTip Views