UNPKG

remeda

Version:

A utility library for JavaScript and Typescript.

1 lines 772 B
{"version":3,"file":"isBoolean.cjs","names":[],"sources":["../src/isBoolean.ts"],"sourcesContent":["import type { NarrowedTo } from \"./internal/types/NarrowedTo\";\n\n/**\n * A function that checks if the passed parameter is a boolean and narrows its type accordingly.\n *\n * @param data - The variable to check.\n * @returns True if the passed input is a boolean, false otherwise.\n * @signature\n * R.isBoolean(data)\n * @example\n * R.isBoolean(true) //=> true\n * R.isBoolean(false) //=> true\n * R.isBoolean('somethingElse') //=> false\n * @category Guard\n */\nexport function isBoolean<T>(\n data: T | boolean,\n): data is NarrowedTo<T, boolean> {\n return typeof data === \"boolean\";\n}\n"],"mappings":"AAeA,SAAgB,EACd,EACgC,CAChC,OAAO,OAAO,GAAS"}