Closed novalis closed 6 years ago
Hmm, That does seem like a bug. If you have time to figure this out, that would be great, and we’d be happy to consider a PR. Otherwise, I will try to find time to look into this at some point. Thanks for reporting this either way!
The change I made locally that fixes the first case is just to add a check for null next to the check for undefined; for the second case, I checked for null and then set it to "null". I can't easily do a PR because I would have to get corporate permission and I can't really justify that for a two-line change. So sorry to be annoying here.
No problem. This should be fixed by https://github.com/Marak/colors.js/commit/654f2b67e375e26c4a932f9fb0f1f2ce11888562 . I tested and colorizing null works in safe mode now, but I was unable to reproduce any issues with Zalgo. If you have a specific way to reproduce any other errors let me know. Otherwise this fix will go out in the next release.
(fix published as 1.3.2)
I also can no longer repro the Zalgo issue.
Thanks for the fix.
colors.red(undefined) does work. Looks like you need to check for null when checking for undefined in https://github.com/Marak/colors.js/blob/f35d715e046cf07c41f7d31eb57d6c16ed4d0f4d/lib/colors.js#L108
Also, even if I fix the above, somehow, null makes it down to https://github.com/Marak/colors.js/blob/master/lib/custom/zalgo.js#L70 without being turned into a string. Expected result: ̵̲̩T̟h̺̩͚̞͚̰̖̀e͏̹̭͎̫ ̳̯̤̭̪N͟e̢̪̰͔̫z̞ͅp̛͉e̞ṟ̬̬̙͈̀d͡i̛̻̥͍̟͓a̬̫̱n̤͉̙͈̣̹͚ ̵h̺̲͚̱̠͎i͏̜̰̦̳̞̫v̹̼̠͙e҉̖͉͍̤ͅ-̱̖͈̰̺̪m̰̤̦̩ͅi̝͖̹̼̦̦̳n̞̗̲̳͍̳̩d̛̞̬ ̬̀o͏̳̣͙̻͎̥f͙̭̮̣͢ͅ ͠c̩ͅh̻̮̩̜̗a̳͉̪̜o͓s̵͈̣̗͔͉̣.̴̝͙ ̩̩̙̱Z̼͉̬̞̥͚̼a̖̼̰̭̱l̗̥̥̠̜̬͓g̵̪̬̫͙o̥͉̲̮ͅ. Actual result:
and he doesn't come.