move styles variable (readablity)

This commit is contained in:
Salah Alhashmi 2023-07-15 10:49:14 +04:00
parent 8be8870078
commit a7ee3d7b11

View file

@ -19,8 +19,6 @@ const levelMapping = [
'ansi16m',
];
const styles = Object.create(null);
const applyOptions = (object, options = {}) => {
if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
throw new Error('The `level` option should be an integer from 0 to 3');
@ -46,6 +44,8 @@ function createChalk(options) {
Object.setPrototypeOf(createChalk.prototype, Function.prototype);
const styles = Object.create(null);
for (const [styleName, style] of Object.entries(ansiStyles)) {
styles[styleName] = {
get() {