preserve order of keys using array-map when sorting