Iterate over an array and create a new sorted object. - Theo's Typesafe Cult