File size: 445 Bytes
9d2d895
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
export interface FireDetectionCountResponse {
  fireDetections: readonly unknown[];
  pagination?: {
    totalCount?: number;
  };
}

export function resolveFireDetectionTotalCount(response: FireDetectionCountResponse): number {
  const reportedTotal = Number(response.pagination?.totalCount);
  return Number.isFinite(reportedTotal) && reportedTotal >= response.fireDetections.length
    ? reportedTotal
    : response.fireDetections.length;
}