Skip to content

Conversation

@hwdegroot
Copy link

When a property value is an array of objects with identical keys,
optionally sort the objects by the value of the keys. This can be
particularly interesting for autogenerated files that are updated by an
external application. i.e. in amplify the configuration files are
serverside updated. Diffing of these files is really hard when the order
changes. A lot of thes files contain arrays of objects with identical
keys. Sorting them by value will always keep them in the same order.

--secondary-sort-by-value, -sv
Sort arrays of objects with identical keys by their value as well.

[
    {
        "b":"c",
        "a": "b",
        "g": "h"
    },
    {
        "b":"c",
        "a": "a",
        "g": "h"
    },
] -> [
    {
        "a": "a",
        "b":"c",
        "g": "h"
    },
    {
        "a": "b",
        "b":"c",
        "g": "h"
    },
]

When a property value is an array of objects with identical keys,
optionally sort the objects by the value of the keys. This can be
particularly interesting for autogenerated files that are updated by an
external application. i.e. in amplify the configuration files are
serverside updated. Diffing of these files is really hard when the order
changes. A lot of thes files contain arrays of objects with identical
keys. Sorting them by value will always keep them in the same order.
@hwdegroot hwdegroot force-pushed the feature-add-secondary-sort-by-value branch from 897cd00 to 12c2b87 Compare February 24, 2023 16:32
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.

1 participant