Hex colors, regular expressions, holes, symbols, BigInt, one-line mode#28
Open
StoneCypher wants to merge 5 commits intoJavascipt:masterfrom
Open
Hex colors, regular expressions, holes, symbols, BigInt, one-line mode#28StoneCypher wants to merge 5 commits intoJavascipt:masterfrom
StoneCypher wants to merge 5 commits intoJavascipt:masterfrom
Conversation
…with # and passing them to chalk.hex()
Author
|
@Javascipt - please enjoy. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously, if you tried to
things would succeed, but if you tried to
the library would crash, unable to find a member function of
chalkcalled#0000ff.This patch modifies caller behavior interpreting the color to check for a seven character string leading with a hash sign, and defers that to
chalk.hexinstead of a chalk member function by name, to add truecolor support to your library.Separately, the display of regular expressions was buggy. They were converted to strings in the pass-through, then displayed as objects because of a bug in reference.
They now display as expected.
This includes deep in container trees.
Separately, holes used to be displayed as rather weird objects.
I wasn't really sure whether I wanted to add this. After all, this is a JSON formatter, and holes don't exist in JSON. Then again, you format
undefined, and that also doesn't exist in JSON, ... so.They're a newly added color type, they default to dark gray, and they now say
<empty>, similar but not identical to the language.At which point, how could I proceed without handling
Symbols?The library crashed when exposed to Symbols, because they don't have a
.toString().So I re-wired the guts a little. Now they display their
.descriptionfield.And if I didn't do
BignumI'd just be a quitter.This is now repaired:
This also works as a member:
Finally, for some use cases I needed a one-line mode.
With one-line enabled:
Thanks for the library!