UNPKG

326 BJavaScriptView Raw
1'use strict';
2const chalk = require('chalk');
3
4let ctx = null;
5exports.get = () => {
6 if (!ctx) {
7 throw new Error('Chalk has not yet been configured');
8 }
9
10 return ctx;
11};
12
13exports.set = options => {
14 if (ctx) {
15 throw new Error('Chalk has already been configured');
16 }
17
18 ctx = new chalk.Instance(options);
19 return ctx;
20};