Last active
March 24, 2016 00:53
-
-
Save marr/fdf603957a19a2227b34 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
function activeCardSort(cards) { | |
const grouped = { | |
active: [], | |
expired: [], | |
deleted: [], | |
...groupBy(cards.map(getCardInfo), 'status') | |
} | |
const byCreatedAt = dateFrom('created_at') | |
const byDeletedAt = dateFrom('deleted_at') | |
grouped.active.sort(byCreatedAt) | |
grouped.expired.sort(byCreatedAt) | |
grouped.deleted.sort(byDeletedAt) | |
return [ ...grouped.active, ...grouped.expired, ...grouped.deleted ] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Active, Not Expired
Within group, display by "created_at" date, most recent first
Active, Expired
Within group, display by "created_at" date, most recent first
Deleted
Within group, display by "deleted_at" date, most recent first