/usr/lib/nodejs/console-group/dist/index.js is in node-console-group 0.3.3-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.install = install;
exports.teardown = teardown;
var _util = require('util');
var util = _interopRequireWildcard(_util);
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
var originalLog = console.log;
var originalWarn = console.warn;
var originalError = console.error;
var prefix = '';
function format(args) {
return util.format.apply(util, _toConsumableArray(args)).replace(/^/gm, prefix);
}
function consoleLog() {
this._stdout.write(format(arguments) + '\n');
}
function consoleError() {
this._stderr.write(format(arguments) + '\n');
}
function consoleGroup() {
prefix += '⎢ ';
this._stdout.write('\x1B[1m' + format(arguments) + '\x1B[22m\n');
}
function consoleGroupEnd() {
prefix = prefix.slice(0, -2);
}
function install() {
console.log = consoleLog;
console.warn = console.error = consoleError;
console.group = consoleGroup;
console.groupEnd = consoleGroupEnd;
}
function teardown() {
console.log = originalLog;
console.warn = originalWarn;
console.error = originalError;
delete console.group;
delete console.groupEnd;
}
|