UNPKG

froebel

Version:
12 lines (11 loc) 427 B
/** Checks if `value` is nullish. Literal types are narrowed accordingly. */ export const nullish = value => value === undefined || value === null; /** * Checks if `value` is not nullish. Literal types are narrowed accordingly. * * @example * ``` * const nums = (...values: (number | undefined)[]): number[] => values.filter(notNullish) * ``` */ export const notNullish = value => value !== null && value !== undefined;