Skip to content

Conversation

@setthase
Copy link

I've noticed that this could be useful, i.e. if you trying to generate some files that then would land in version control systems, like git.

If we sort object by keys, then each time when we run gulp we could expect that diff tools will show only what really have changed. Currently each time I run gulp on three files I've got different result and my git is shouting on me that I've changed whole file, when I didn't touch JSON files at all.

I know that by definition JS Objects don't have an order, but in practice V8 implementation is keeping keys in the order they were added.

setthase and others added 3 commits April 14, 2015 09:46
I've noticed that this could be useful, i.e. if you trying to generate some files that then would land in version control systems, like git.

If we sort object by keys, then each time when we run gulp we could expect that diff tools will show only what really have changed. Currently each time I run gulp on three files I've got different result and my git is shouting on me that I've changed whole file, when I didn't touch JSON files at all.

I know that by definition JS Objects don't have an order, but in practice V8 implementation is keeping keys in the order they were added.
@webcaetano
Copy link

+1.

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

Successfully merging this pull request may close these issues.

2 participants