mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-13 15:36:25 +00:00
12 lines
276 B
TypeScript
12 lines
276 B
TypeScript
/**
|
|
* Coerces a value to a number with optional default value.
|
|
* @param val the value to coerce
|
|
* @param def default value
|
|
* @returns cocerced value
|
|
*/
|
|
export function coerceNumber(
|
|
val: number | null | undefined,
|
|
def?: number
|
|
): number {
|
|
return val ?? def ?? 0;
|
|
}
|