2.0.7 • Published 2 months ago

@zerodep/is-boolean v2.0.7

Weekly downloads
-
License
MIT
Repository
github
Last release
2 months ago

@zerodep/is-boolean

version language types license

CodeFactor Known Vulnerabilities

A simple, performant utility to determine if a value is a boolean.

Full documentation is available at the zerodep.app page.

Examples

All @zerodep packages support both ESM and CJS.

import { isBoolean } from '@zerodep/is-boolean';
// or
const { isBoolean } = require('@zerodep/is-boolean');

Positive Response

isBoolean(true); // true
isBoolean(false); // true
isBoolean(new Boolean(true)); // true

Negative Response

isBoolean(['a', 'b', 'c']); // false
isBoolean(1000n); // false
isBoolean(new Date()); // false
isBoolean(''); // false
isBoolean(new Error('message')); // false
isBoolean(3.14); // false
isBoolean(() => 'function'); // false
isBoolean(42); // false
isBoolean(
  new Map([
    ['a', 1],
    ['b', 2],
  ])
); // false
isBoolean(null); // false
isBoolean({ an: 'object' }); // false
isBoolean(new Promise(() => {})); // false
isBoolean(/[regex]+/gi); // false
isBoolean(new Set([1, 2, 3])); // false
isBoolean('a string'); // false
isBoolean(Symbol()); // false
isBoolean(new Int32Array(2)); // false
isBoolean(undefined); // false
2.0.7

2 months ago

2.0.6

2 months ago

2.0.5

2 months ago

2.0.2

10 months ago

2.0.4

7 months ago

2.0.1

11 months ago