File size: 722 Bytes
f80131c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
type AuditEvent = {
    readonly id: string;
    readonly kind: "created" | "reviewed" | "approved";
    readonly detail: string;
};

const events: AuditEvent[] = [
    { id: "evt-001", kind: "created", detail: "draft request opened" },
    { id: "evt-002", kind: "reviewed", detail: "extraction fixture marker: shared code sample" },
    { id: "evt-003", kind: "approved", detail: "manager approval recorded" },
];

function describeReviewEvents(auditEvents: readonly AuditEvent[]): string[] {
    return auditEvents
        .filter((event) => event.kind === "reviewed")
        .map((event) => `${event.id}: ${event.detail}`);
}

for (const description of describeReviewEvents(events)) {
    console.log(description);
}