Created
March 31, 2016 23:40
-
-
Save marr/7cdd4ef101f9262c2edb9904c5052454 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let vehicles = groupBy(this.state.vehicles, 'license_plate') | |
vehicles = Object.keys(vehicles).map(license_plate => { | |
const activeVehicles = vehicles[license_plate] | |
.filter(notDeleted) | |
if (!activeVehicles.length) { | |
const byDeleted = dateFrom('deleted_at') | |
return vehicles[license_plate].sort(byDeleted)[0] | |
} | |
return activeVehicles[0] | |
}) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment