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

"Sorting" result by keys #4

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

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