Closed joliss closed 4 years ago
I noticed an issue in the test code when I was working on another patch and it reported a test failure:
I tracked this down to the sortKeys helper function, which this pull request fixes!
sortKeys
Current:
> function sortKeys (item) { ... const keys = Object.keys(item).sort() ... return keys.reduce((hsh, k) => { ..... return { ...hsh, [k]: item[k] } ..... }) ... } undefined > sortKeys({foo: 1, bar: 2}) { '0': 'b', '1': 'a', '2': 'r', foo: 1 } >
My patch:
> function sortKeys(item) { ... const ordered = {} ... for (let key of Object.keys(item).sort()) { ..... ordered[key] = item[key] ..... } ... return ordered ... } undefined > sortKeys({foo: 1, bar: 2}) { bar: 2, foo: 1 } >
I noticed an issue in the test code when I was working on another patch and it reported a test failure:
I tracked this down to the
sortKeys
helper function, which this pull request fixes!Current:
My patch: