2023-11-30 13:01:29 -05:00
|
|
|
// Copyright (c) Tailscale Inc & AUTHORS
|
|
|
|
// SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
|
|
|
|
/**
|
|
|
|
* assertNever ensures a branch of code can never be reached,
|
|
|
|
* resulting in a Typescript error if it can.
|
|
|
|
*/
|
|
|
|
export function assertNever(a: never): never {
|
|
|
|
return a
|
|
|
|
}
|
2023-12-04 15:20:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
* pluralize is a very simple function that returns either
|
|
|
|
* the singular or plural form of a string based on the given
|
|
|
|
* quantity.
|
|
|
|
*
|
|
|
|
* TODO: Ideally this would use a localized pluralization.
|
|
|
|
*/
|
|
|
|
export function pluralize(signular: string, plural: string, qty: number) {
|
|
|
|
return qty === 1 ? signular : plural
|
|
|
|
}
|