Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Address a possible pitfall related to config file #25

Open
demacdonald opened this issue Feb 7, 2017 · 0 comments
Open

Address a possible pitfall related to config file #25

demacdonald opened this issue Feb 7, 2017 · 0 comments

Comments

@demacdonald
Copy link
Collaborator

demacdonald commented Feb 7, 2017

Currently iterate over the fields provided in the config ("error", "debug", etc) for colors.

Would be better if we iterated over the known set of functions we support instead.

In the case someone adds additional fields in the config that do not belong there we should not be creating additional chalk functions.

For example:

{
    "colors": {
        "logs": {
            "default": ["red"],
            "error": ["bgRed", "cyan"]
            "a": ["bgRed", "cyan"]
            "b": ["bgRed", "cyan"]
            "c": ["bgRed", "cyan"]
            "d": ["bgRed", "cyan"]
            "e": ["bgRed", "cyan"]
            "f": ["bgRed", "cyan"]
            "g": ["bgRed", "cyan"]
            "h": ["bgRed", "cyan"]
            "i": ["bgRed", "cyan"]
        }
    }
}

In above example, we are currently building chalk functions for each of them even though we will never use them.

@vajahath vajahath changed the title Optimization Address a possible pitfall related to config file Feb 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants