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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix bug when passing multiple arguments to log #78
Conversation
src/utils/proxy-console.js
Outdated
@@ -200,6 +200,12 @@ | |||
} | |||
|
|||
const replacements = args[0].match(/(%[sc])([^%]*)/gm) | |||
|
|||
// If no replacement is found, we return a unstyled text | |||
if (!replacements || replacements === null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (!replacements) {
is the same but shorter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually pleace change to
if (!replacements || !replacements.length) {
because we do replacements.shift() below that
anyway Thanks for contribution! 馃憤
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just did the change!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 minor change and good to go 馃檲
@@ -174,7 +174,7 @@ | |||
*/ | |||
const styleText = function (textArray, styles = []) { | |||
return textArray.map((text, index) => { | |||
return index ? `<span style="${styles.shift()}">${text}</span>` : text | |||
return index ? `<span style="${styles.shift()}">${stringify(text)}</span>` : text |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Prozi the item in WIP is referring to this:
because styleText
is not expecting arrays at all, but if we stringify whatever arguments that are passed in, the function can handle and return those as strings properly
Can you do a follow up please? @Prozi |
hey!
really good playground, super nice, i already switch from jsbin to codepan 馃
i made this PR because i notice that when calling
console.log
with multiple arguments, the following error appears in the integrated console:the error was due to the support of styling logs, i just check if any styling is intended, and if is not, it should return an unstyled text, i also added a blank when joining arguments to have them separated, but i'm not aware of the use case of the previous way
TODO:
please review @egoist @Prozi :)