count
count(
iterable):number
Defined in: packages/core/src/iterable/count.ts:15
Counts the elements of an iterable, consuming it.
Named for what it returns rather than length, which would promise O(1).
Time complexity: O(1) for an Array, Set or Map, which already know
their own size; O(n) for anything else, which has to be drained.
Parameters
Section titled “Parameters”iterable
Section titled “iterable”Iterable<unknown>
The iterable to count.
Returns
Section titled “Returns”number
How many elements it yielded.