Add ChalkClass
This commit is contained in:
parent
7f6e5630b0
commit
8cb6c683cb
1 changed files with 7 additions and 0 deletions
7
index.js
7
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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue