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

Strip control codes in error messages. #9

Merged
merged 1 commit into from
Jan 25, 2016
Merged

Strip control codes in error messages. #9

merged 1 commit into from
Jan 25, 2016

Conversation

aaugustin
Copy link
Contributor

No description provided.

@aaugustin
Copy link
Contributor Author

This is a follow-up to django-webpack/django-webpack-loader#39.

It looks like you were just missing stripAnsi in one location.

@aaugustin
Copy link
Contributor Author

While we're there, I find it surprising to depend on a package which only provides a 60-char function and itself depends on another package which only provides an 80-char regex and manages to get it wrong (but not in a way that affects me). You're going through all this just to avoid implementing a one liner:

stripAnsi = message => message.replace(
    new RegExp('(?:\\x1b\\x5b|\\x9b)[\\x30-\\x3f]*[\\x20-\\x2f]*[\\x40-\\x7e]', 'g'), '')

I assume it makes sense from some perspective, but it just sent me on a wrong track for longer than I'm willing to admit :-(

Anyway, the fix above should suffice, so let's leave it there :-)

@SBoudrias
Copy link
Contributor

@aaugustin that's the node way.

If you think that module have a bug, well then open a bug or a PR, we you'll fix it on over a 100 other projects - to me that's way more powerful than an inline regex.

owais added a commit that referenced this pull request Jan 25, 2016
Strip control codes in error messages.
@owais owais merged commit 0c385e7 into django-webpack:master Jan 25, 2016
@aaugustin
Copy link
Contributor Author

@SBoudrias I get the idea of packaging reusable modules; I was pointing out that there's a point of diminishing returns. In my opinion, packaging each line of code separately (like the ansi-* packages do) takes it too far.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants