UNPKG

dwnpm

Version:

Decentralized Registry Package Manager (DRPM) helps developers publish, install, find and manage Decentralized Packages (DPKs) published to Decentralized Web Nodes (DWNs). DRPM does this by looking up a Decentralized Identifier (DID) to find its DID docum

73 lines 1.95 kB
import chalk from 'chalk'; export class Formatter { constructor() { } colorizeFormat({ message, color, options = {} }) { const colorized = this.colorize(message, color); const { underline, bold } = options; if (underline && bold) { return this.bold(this.underline(colorized)); } if (underline) { return this.underline(colorized); } if (bold) { return this.bold(colorized); } return colorized; } bold(message) { return chalk.bold(message); } underline(message) { return chalk.underline(message); } boldUnderline(message) { return this.bold(this.underline(message)); } format(message, options = {}) { const { underline, bold } = options; if (underline && bold) { return this.underline(this.bold(message)); } if (underline) { return this.underline(message); } if (bold) { return this.bold(message); } return message; } colorize(message, color) { switch (color) { case 'red': return this.red(message); case 'green': return this.green(message); case 'blue': return this.blue(message); case 'yellow': return this.yellow(message); case 'gray': return this.gray(message); default: return message; } } red(message) { return chalk.red(message); } green(message) { return chalk.green(message); } blue(message) { return chalk.blue(message); } yellow(message) { return chalk.yellow(message); } gray(message) { return chalk.gray(message); } } export default new Formatter(); //# sourceMappingURL=formatter.js.map