UNPKG

froebel

Version:
25 lines (19 loc) 668 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.nullish = exports.notNullish = void 0; /** Checks if `value` is nullish. Literal types are narrowed accordingly. */ const nullish = value => value === undefined || value === null; exports.nullish = nullish; /** * Checks if `value` is not nullish. Literal types are narrowed accordingly. * * @example * ``` * const nums = (...values: (number | undefined)[]): number[] => values.filter(notNullish) * ``` */ const notNullish = value => value !== null && value !== undefined; exports.notNullish = notNullish; module.exports = Object.assign(exports.default || {}, exports);