Closed mhkeller closed 2 years ago
From the changes made in https://github.com/pbeshai/tidy/issues/34, keys are now prepended on objects in groupBy but the docs still show them being appended – groupBy.entries() for example:
const data = [ { str: 'a', ing: 'x', foo: 'G', value: 1 }, { str: 'b', ing: 'x', foo: 'H', value: 100 }, { str: 'b', ing: 'x', foo: 'K', value: 200 }, { str: 'a', ing: 'y', foo: 'G', value: 2 }, { str: 'a', ing: 'y', foo: 'H', value: 3 }, { str: 'a', ing: 'y', foo: 'K', value: 4 }, { str: 'b', ing: 'y', foo: 'G', value: 300 }, { str: 'b', ing: 'z', foo: 'H', value: 400 }, { str: 'a', ing: 'z', foo: 'K', value: 5 }, { str: 'a', ing: 'z', foo: 'G', value: 6 }, ] tidy( data, groupBy('str', [ summarize({ total: sum('value') }) ], groupBy.entries()) ) // output: [ ["a", [{"total": 21, "str": "a"}]], ["b", [{"total": 1000, "str": "b"}]] ]
But putting that into the playground gives me:
[ ["a", [{"str": "a", "total": 21}]], ["b", [{"str": "b", "total": 1000}]] ]
Thanks for the heads-up! PRs welcome
From the changes made in https://github.com/pbeshai/tidy/issues/34, keys are now prepended on objects in groupBy but the docs still show them being appended – groupBy.entries() for example:
But putting that into the playground gives me: