countFleetsfunction
How many of each fleet a list of objects holds, and how many objects there are in all: what a filter shows as "N of M".
Import it
import { countFleets } from "@johnmorrisdotca/chikyu-earth/catalogue";
Definition
function countFleets(objects: Iterable<{ name: string; kind?: ObjectKind; }>): { fleets: Record<string, number>; total: number; }
Parameters
| Name | Type | Description |
|---|---|---|
objects | Iterable<{ name: string; kind?: ObjectKind; }> | The objects' names and kinds. |
Returns
{ fleets: Record<string, number>; total: number; }
The count in each fleet (every fleet, 0 included) and the total.
Examples
import { countFleets } from "@johnmorrisdotca/chikyu-earth/catalogue";
const { total, fleets } = countFleets([{ name: "STARLINK-1007", kind: "PAY" }, { name: "STARLINK-1008", kind: "PAY" }, { name: "HST", kind: "PAY" }]);
console.log(fleets["starlink"], total);2 3What it prints (run when this page was built)