{"size": 1329, "ext": "js", "max_stars_repo_path": "src/my-console.js", "max_stars_repo_name": "Zelgadis87/npm-versionator", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/my-console.js", "max_issues_repo_name": "Zelgadis87/npm-versionator", "max_issues_repo_issues_event_min_datetime": "2021-05-06T22:35:06.000Z", "max_issues_repo_issues_event_max_datetime": "2021-05-06T22:35:06.000Z", "max_forks_repo_path": "src/my-console.js", "max_forks_repo_name": "Zelgadis87/npm-versionator", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": 1, "max_forks_count": null, "avg_line_length": 39.0882352941, "max_line_length": 161, "alphanum_fraction": 0.5342362679}

const Console = require( './console.js' )
	, chalk = require( 'chalk' )
	, _ = require( 'lodash' )
	;

let console = Console.create( 60 );
let iff = ( c, t, f ) => c ? t() : f();
let info = ( m ) => console.print( m, chalk.green );
let warn = ( m ) => console.print( m, chalk.yellow );
let error = ( m ) => console.print( m, chalk.red );
let command = ( m ) => console.print( m.replace( 'npm.cmd', 'npm' ), chalk.cyan );

console.info = ( m, c ) => info( m ) & iff( c, () => command( ' ' + c ), _.noop ) & console.line();
console.warn = ( m, c ) => warn( m ) & iff( c, () => command( ' ' + c ), _.noop ) & console.line();
console.error = ( m, c ) => error( m ) & iff( c, () => command( ' ' + c ), _.noop ) & console.line();
console.command = ( c ) => command( c ) & console.line();
console.title = ( m, fn = info ) => { let hr = _.repeat( '-', m.length ); console.outdent( Number.MAX_SAFE_INTEGER ); fn( hr + '\n' + m + '\n' + hr + '\n' ); };

console.task = ( t ) => {
	console.splitLongLines = false;
	console.indent( t.done ? '✓' : '✗' );
	console.print( t.message, t.done ? chalk.green : chalk.yellow );
	if ( t.command && !t.done ) {
		console.print( ' ' );
		command( ' ' + t.command );
	}
	console.line();
	console.outdent();
	console.splitLongLines = true;
};

module.exports = console;
