Skip to main content

isBoolean

A function that checks whether a given argument is a boolean, and if so, narrows the type of the argument to boolean.


Code

🔗 View source code

Interface

typescript
const isBoolean: (arg: unknown) => arg is boolean

Usage

typescript
import { isBoolean } from '@modern-kit/utils';

isBoolean(true); // true
isBoolean(false); // true

isBoolean(123); // false
isBoolean('123'); // false
isBoolean(() => {}); // false
isBoolean({}); // false
isBoolean([]); // false