How to find an object, inside which is the smallest and largest price
"2018-02": { "2018-02-09": { "price": 13025 }, "2018-02-15": { "price": 12499 } }, "2018-04": { "2018-04-01": { "price": 15990 } } The result should be an object:
{ "max": { "price": 15990, "month": "2018-04", "date": "2018-04-01" }, "min": { "price": 12499, "month": "2018-02", "date": "2018-02-15" } } Initially I planned to sort the keys of the days of each month first, and then the months themselves, but an algorithmic porridge was brewing in my head and something I wanted to write such a whopper. Is there a simpler way?