move Chalk class to the bottom (readablity)

This commit is contained in:
Salah Alhashmi 2023-07-15 10:46:50 +04:00
parent f399cd0ff6
commit 8be8870078

View file

@ -31,13 +31,6 @@ const applyOptions = (object, options = {}) => {
object.level = options.level === undefined ? colorLevel : options.level;
};
export class Chalk {
constructor(options) {
// eslint-disable-next-line no-constructor-return
return chalkFactory(options);
}
}
const chalkFactory = options => {
const chalk = (...strings) => strings.join(' ');
applyOptions(chalk, options);
@ -202,6 +195,14 @@ const applyStyle = (self, string) => {
Object.defineProperties(createChalk.prototype, styles);
const chalk = createChalk();
export class Chalk {
constructor(options) {
// eslint-disable-next-line no-constructor-return
return chalkFactory(options);
}
}
export const chalkStderr = createChalk({level: stderrColor ? stderrColor.level : 0});
export {