remeda
Version:
A utility library for JavaScript and Typescript.
1 lines • 844 B
Source Map (JSON)
{"version":3,"file":"isNullish.cjs","names":[],"sources":["../src/isNullish.ts"],"sourcesContent":["import type { NarrowedTo } from \"./internal/types/NarrowedTo\";\n\n/**\n * A function that checks if the passed parameter is either `null` or\n * `undefined` and narrows its type accordingly.\n *\n * @param data - The variable to check.\n * @returns True if the passed input is either `null` or `undefined`, false\n * otherwise.\n * @signature\n * R.isNullish(data)\n * @example\n * R.isNullish(undefined) //=> true\n * R.isNullish(null) //=> true\n * R.isNullish('somethingElse') //=> false\n * @category Guard\n */\nexport function isNullish<T>(\n data: T | null | undefined,\n): data is NarrowedTo<T, null | undefined> {\n return data === null || data === undefined;\n}\n"],"mappings":"AAiBA,SAAgB,EACd,EACyC,CACzC,OAAO,GAAS"}