move styles variable (readablity)
This commit is contained in:
parent
8be8870078
commit
a7ee3d7b11
1 changed files with 2 additions and 2 deletions
|
|
@ -19,8 +19,6 @@ const levelMapping = [
|
||||||
'ansi16m',
|
'ansi16m',
|
||||||
];
|
];
|
||||||
|
|
||||||
const styles = Object.create(null);
|
|
||||||
|
|
||||||
const applyOptions = (object, options = {}) => {
|
const applyOptions = (object, options = {}) => {
|
||||||
if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
|
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');
|
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);
|
Object.setPrototypeOf(createChalk.prototype, Function.prototype);
|
||||||
|
|
||||||
|
const styles = Object.create(null);
|
||||||
|
|
||||||
for (const [styleName, style] of Object.entries(ansiStyles)) {
|
for (const [styleName, style] of Object.entries(ansiStyles)) {
|
||||||
styles[styleName] = {
|
styles[styleName] = {
|
||||||
get() {
|
get() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue