Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | 29x 894x | /** * Check if a value is not undefined or null. A non-nullable return is typed as such. * * @example * * ```ts * const arr: (string | undefined | null)[] = ['a', null, 'b', undefined, 'c']; * const result: string[] = arr.filter(isNotNullable); * ``` * * @param value - The value to check. * @returns `true` if the value is not undefined or null, `false` otherwise. */ export const isNotNullable = <T>(value: T | undefined | null): value is NonNullable<T> => value !== undefined && value !== null; |