https://yami.io/reduce-foreach-filter-map/