Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

feat(jsonFilter): add optional arg to define custom indentation #10297

Closed
wants to merge 3 commits into from

Conversation

caitp
Copy link
Contributor

@caitp caitp commented Dec 2, 2014

No description provided.

@googlebot
Copy link

We found a Contributor License Agreement for you (the sender of this pull request) and all commit authors, but as best as we can tell these commits were authored by someone else. If that's the case, please add them to this pull request and have them confirm that they're okay with these commits being contributed to Google. If we're mistaken and you did author these commits, just reply here to confirm.

@caitp
Copy link
Contributor Author

caitp commented Dec 2, 2014

@petebacondarwin / @lgalfaso can you double check this for me? There was a small breaking change in the original CL, but fixing it makes the code maybe bigger than we'd like --- so I'll let you make the call on whether we want to do that. Realistically, the impact of the break is pretty minimal. Either way, I want the extra tests.

* @returns {string|undefined} JSON-ified string representing `obj`.
*/
function toJson(obj, pretty) {
if (typeof obj === 'undefined') return undefined;
return JSON.stringify(obj, toJsonReplacer, pretty ? ' ' : null);
if (typeof pretty !== "number") {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I always prefer to use the helpers (isNumber()).
(And even if you choose not to, using single quotes is more consistent.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah true --- I dunno if we need to do this or not anyway though, like I said it's a pretty low-impact breaking change

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lgalfaso
Copy link
Contributor

lgalfaso commented Dec 2, 2014

otherwise, LGTM

@caitp caitp closed this in 9a616ea Dec 2, 2014
@petebacondarwin
Copy link
Contributor

Good work all!

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

Successfully merging this pull request may close these issues.

6 participants