Skip to content

Commit

Permalink
Merge branch 'release/v0.10.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkGriffiths committed Nov 5, 2018
2 parents aa98c08 + cbde480 commit 68fafbe
Show file tree
Hide file tree
Showing 10 changed files with 3,430 additions and 1,982 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ branches:
language: node_js
node_js:
- stable
- 10
- 9
- 8
sudo: false
Expand Down
20 changes: 10 additions & 10 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }

var util = _interopDefault(require('util'));
var _console = _interopDefault(require('console'));
var console = require('console');
var termNG = _interopDefault(require('term-ng'));
var chalk = _interopDefault(require('chalk'));
var sparkles = _interopDefault(require('sparkles'));
Expand Down Expand Up @@ -52,7 +52,7 @@ const consoleFactory = function (options = {}) {

const prefixFormatter = (pfix => pfix ? () => `[${pfix}] ` : () => '')(prefix);

return Object.assign(Object.create(_console.Console), {
return Object.assign(new console.Console(sOut, sErr), {
_stdout: sOut,
_stderr: sErr,
threshold: verbosity ? verbosity : 3,
Expand Down Expand Up @@ -179,14 +179,14 @@ const consoleFactory = function (options = {}) {
sOut.write(format(inspect(obj, options)));
},

pretty(obj, depth = 0) {
pretty(obj, depth = 0, color = true) {
sOut.write(format('Content: %s\n', inspect(obj, {
depth,
colors: termNG.color.basic
}).slice(0, -1).replace(/^{/, 'Object\n ').replace(/^\[/, 'Array\n ').replace(/^(\w+) {/, '$1').replace(/:/g, ' ▸').replace(/,\n/g, '\n')));
colors: color && termNG.color.basic
}).slice(0, -1).replace(/^{/, 'Object\n ').replace(/^\[/, 'Array\n ').replace(/^(\w+) {/, '$1').replace(/(\w+):/g, '$1 ▸').replace(/,\n/g, '\n')));
},

yargs(obj) {
yargs(obj, color = true) {
const parsed = {};
Object.keys(obj).forEach(key_ => {
const val = obj[key_];
Expand All @@ -211,15 +211,15 @@ const consoleFactory = function (options = {}) {
}
});
sOut.write(format('Options (yargs):\n %s\n', inspect(parsed, {
colors: termNG.color.basic
}).slice(2, -1).replace(/:/g, ' ▸').replace(/,\n/g, '\n')));
colors: color && termNG.color.basic
}).slice(2, -1).replace(/(\w+):/g, '$1 ▸').replace(/,\n/g, '\n')));
}

});
};


function console(options) {
function console$1(options) {
return consoleFactory(options);
}

Expand All @@ -229,6 +229,6 @@ function createConsole(options) {

const getVersion = level => metadata.version(level);

exports.console = console;
exports.console = console$1;
exports.createConsole = createConsole;
exports.getVersion = getVersion;
16 changes: 8 additions & 8 deletions index.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import util from 'util';
import _console from 'console';
import { Console } from 'console';
import termNG from 'term-ng';
import chalk from 'chalk';
import sparkles from 'sparkles';
Expand Down Expand Up @@ -46,7 +46,7 @@ const consoleFactory = function (options = {}) {

const prefixFormatter = (pfix => pfix ? () => `[${pfix}] ` : () => '')(prefix);

return Object.assign(Object.create(_console.Console), {
return Object.assign(new Console(sOut, sErr), {
_stdout: sOut,
_stderr: sErr,
threshold: verbosity ? verbosity : 3,
Expand Down Expand Up @@ -173,14 +173,14 @@ const consoleFactory = function (options = {}) {
sOut.write(format(inspect(obj, options)));
},

pretty(obj, depth = 0) {
pretty(obj, depth = 0, color = true) {
sOut.write(format('Content: %s\n', inspect(obj, {
depth,
colors: termNG.color.basic
}).slice(0, -1).replace(/^{/, 'Object\n ').replace(/^\[/, 'Array\n ').replace(/^(\w+) {/, '$1').replace(/:/g, ' ▸').replace(/,\n/g, '\n')));
colors: color && termNG.color.basic
}).slice(0, -1).replace(/^{/, 'Object\n ').replace(/^\[/, 'Array\n ').replace(/^(\w+) {/, '$1').replace(/(\w+):/g, '$1 ▸').replace(/,\n/g, '\n')));
},

yargs(obj) {
yargs(obj, color = true) {
const parsed = {};
Object.keys(obj).forEach(key_ => {
const val = obj[key_];
Expand All @@ -205,8 +205,8 @@ const consoleFactory = function (options = {}) {
}
});
sOut.write(format('Options (yargs):\n %s\n', inspect(parsed, {
colors: termNG.color.basic
}).slice(2, -1).replace(/:/g, ' ▸').replace(/,\n/g, '\n')));
colors: color && termNG.color.basic
}).slice(2, -1).replace(/(\w+):/g, '$1 ▸').replace(/,\n/g, '\n')));
}

});
Expand Down
Loading

0 comments on commit 68fafbe

Please sign in to comment.