| 1 | /** |
| 2 | * Normalizes a collection count to a non-negative integer. `NaN` and |
| 3 | * non-positive values become `0`; positive infinity is preserved. |
| 4 | * |
| 5 | * @internal |
| 6 | */ |
| 7 | export const normalize = (n: number): number => n > 0 ? Math.floor(n) : 0 |
| 8 | |
| 9 | /** |
| 10 | * Normalizes a collection count to an integer greater than or equal to `1`. |
| 11 | * |
| 12 | * @internal |
| 13 | */ |
| 14 | export const normalizeNonEmpty = (n: number): number => Math.max(1, normalize(n)) |