From 8cb6c683cb841a75c6ccf8ae879776b325a4515f Mon Sep 17 00:00:00 2001 From: Tom Sherman Date: Sat, 26 Jan 2019 13:18:30 +0000 Subject: [PATCH] Add ChalkClass --- index.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/index.js b/index.js index 73598be..4925417 100644 --- a/index.js +++ b/index.js @@ -25,6 +25,12 @@ function applyOptions(object, options = {}) { object.enabled = 'enabled' in options ? options.enabled : object.level > 0; } +class ChalkClass { + constructor (options) { + return Chalk(options) + } +} + function Chalk(options) { // We check for this.template here since calling `chalk.constructor()` // by itself will have a `this` of a previously constructed chalk object @@ -38,6 +44,7 @@ function Chalk(options) { Object.setPrototypeOf(chalk.template, chalk); chalk.template.constructor = Chalk; + chalk.template.instance = ChalkClass; return chalk.template; }