(appA, appB)
| 1 | export function byTimeThenNull (appA, appB) { |
| 2 | // console.log('appA.lastUpdated', appA.lastUpdated) |
| 3 | |
| 4 | // equal items sort equally |
| 5 | if (appA.lastUpdated === appB.lastUpdated) { |
| 6 | return 0; |
| 7 | } |
| 8 | // nulls sort after anything else |
| 9 | else if (appA.lastUpdated === null) { |
| 10 | return 1; |
| 11 | } |
| 12 | else if (appB.lastUpdated === null) { |
| 13 | return -1; |
| 14 | } |
| 15 | |
| 16 | return appB.lastUpdated.timestamp - appA.lastUpdated.timestamp |
| 17 | } |
| 18 | |
| 19 | export default function (appList) { |
| 20 | return appList.sort(byTimeThenNull) |
nothing calls this directly
no outgoing calls
no test coverage detected