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

Suggestion: Option to remove single quotes from output of console.log #572

Closed
pvanb opened this issue Jul 31, 2023 · 4 comments
Closed

Suggestion: Option to remove single quotes from output of console.log #572

pvanb opened this issue Jul 31, 2023 · 4 comments

Comments

@pvanb
Copy link

pvanb commented Jul 31, 2023

As a follow-up suggestion to #266, could it be an option whether or not to show the output of console.log as quoted?

I understand that this means losing syntax highlighting but sometimes I want to see the raw output without the quotes and syntax highlighting is not important.

For example, suppose I'm looping through some data and I want to console log the results to generate some CSV data:

const data = [
    { "teamId": "00001", "teamNo": 1, "teamName": "Team Foo", "userName": "John Doe", "points": 312.0, "rank": 1 },
    { "teamId": "00002", "teamNo": 2, "teamName": "Team Bar", "userName": "Jane Doe", "points": 311.0, "rank": 2 },
    { "teamId": "00003", "teamNo": 3, "teamName": "Team Baz", "userName": "Enola Holmes", "points": 272.0, "rank": 3 }
];

data.forEach(d => {
  console.log(`${d.rank},${d.teamName},${d.userName},${d.points}`);
});

Generates the output:

'1,Team Foo,John Doe,312'
'2,Team Bar,Jane Doe,311'
'3,Team Baz,Enola Holmes,272'

Compared to running the same code at https://jsconsole.com generates:

1,Team Foo,John Doe,312
2,Team Bar,Jane Doe,311
3,Team Baz,Enola Holmes,272

The latter can easily be copied and pasted to create a CSV file, or directly into a spreadsheet app as CSV data where syntax highlighting doesn't matter.

@lukehaas
Copy link
Owner

lukehaas commented Aug 1, 2023

@pvanb, thanks for raising this.
The example you've provided is an interesting use case that I hadn't considered before.

I'll have a think about this and get back to you.

@dan-farley
Copy link

I would definitely like this feature as well!

@javier250369
Copy link

Definitely like this feature !

@lukehaas
Copy link
Owner

@pvanb @dan-farley @javier250369 this is now possible in the latest release of RunJS.
To do this, turn off output highlighting in the appearance settings.

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

No branches or pull requests

4 participants