(list: Notification[])
| 56 | const NOTIFICATION_TTL_MS = 1000 * 60 * 60 * 24 * 30 |
| 57 | |
| 58 | function pruneNotifications(list: Notification[]) { |
| 59 | const cutoff = Date.now() - NOTIFICATION_TTL_MS |
| 60 | const pruned = list.filter((n) => n.time >= cutoff) |
| 61 | if (pruned.length <= MAX_NOTIFICATIONS) return pruned |
| 62 | return pruned.slice(pruned.length - MAX_NOTIFICATIONS) |
| 63 | } |
| 64 | |
| 65 | function createNotificationIndex(): NotificationIndex { |
| 66 | return { |
no outgoing calls
no test coverage detected