@fvilers/is-boolean
TypeScript icon, indicating that this package has built-in type declarations

2.0.0 • Public • Published

@fvilers/is-boolean

A TypeScript type guard that validates if the given value is a boolean

Installation

npm install @fvilers/is-boolean

or

yarn add @fvilers/is-boolean

ECMAScript module

Starting with version 2.0.0, this library will be published as an ECMAScript module.

Usage

import { isBoolean } from "@fvilers/is-boolean";

const variable: any = true;

if (isBoolean(variable)) {
  // From here, variable is strongly typed as a boolean
  console.log("Variable is a boolean that returns", variable);
} else {
  console.log("Variable is not a boolean");
}

It will output:

Variable is a boolean that returns true

Package Sidebar

Install

npm i @fvilers/is-boolean

Weekly Downloads

3

Version

2.0.0

License

MIT

Unpacked Size

2.87 kB

Total Files

7

Last publish

Collaborators

  • fvilers