npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

booleanlab

v1.0.3

Published

A comprehensive TypeScript utility library for advanced boolean operations. Simplify your boolean logic with easy-to-use functions.

Readme

📘 booleanlab

A comprehensive TypeScript utility library for advanced boolean operations. Simplify your boolean logic with easy-to-use functions.


📦 Installation

Install booleanlab via npm or yarn:

npm install booleanlab
yarn add booleanlab

🚀 Usage

Import the required functions into your TypeScript or JavaScript project:

import { trueValue, falseValue, isEqual, andOperation } from 'booleanlab';

console.log(trueValue());  // true
console.log(falseValue()); // false
console.log(isEqual(true, false)); // false
console.log(andOperation(true, false)); // false

🔧 API Reference

🟢 trueValue()

Returns the boolean value true.

trueValue(); // true

🔴 falseValue()

Returns the boolean value false.

falseValue(); // false

📊 isEqual(a: boolean, b: boolean)

Returns true if both boolean values are equal, false otherwise.

isEqual(true, true);  // true
isEqual(true, false); // false

🔄 isNotEqual(a: boolean, b: boolean)

Returns true if both boolean values are not equal, false otherwise.

isNotEqual(true, false); // true
isNotEqual(false, false); // false

🔗 andOperation(a: boolean, b: boolean)

Performs a logical AND operation on two boolean values.

andOperation(true, true);   // true
andOperation(true, false);  // false

🔘 orOperation(a: boolean, b: boolean)

Performs a logical OR operation on two boolean values.

orOperation(true, false);  // true
orOperation(false, false); // false

xorOperation(a: boolean, b: boolean)

Performs a logical XOR (exclusive OR) operation.

xorOperation(true, false); // true
xorOperation(true, true);  // false

🔄 negate(a: boolean)

Returns the negation (inverse) of a boolean value.

negate(true);  // false
negate(false); // true

isTrue(a: boolean)

Checks if a value is exactly true.

isTrue(true);  // true
isTrue(false); // false

isFalse(a: boolean)

Checks if a value is exactly false.

isFalse(false); // true
isFalse(true);  // false

🔢 toBinary(a: boolean)

Converts a boolean to a binary number (1 for true, 0 for false).

toBinary(true);  // 1
toBinary(false); // 0

🔁 toBoolean(a: any)

Converts any value to a boolean (falsy values become false, truthy values become true).

toBoolean(1);    // true
toBoolean(0);    // false
toBoolean(null); // false

🚫 nandOperation(a: boolean, b: boolean)

Performs a logical NAND (NOT AND) operation.

nandOperation(true, true);  // false
nandOperation(false, true); // true

🚫 norOperation(a: boolean, b: boolean)

Performs a logical NOR (NOT OR) operation.

norOperation(false, false); // true
norOperation(true, false);  // false

🔡 toString(value: boolean)

Converts a boolean value to a string representation ("True" or "False").

toString(true);  // "True"
toString(false); // "False"

isTruthy(value: any)

Checks if a value is truthy (not null, undefined, false, 0, NaN, or an empty string).

isTruthy(1);     // true
isTruthy('');    // false
isTruthy(null);  // false

isFalsy(value: any)

Checks if a value is falsy (null, undefined, false, 0, NaN, or an empty string).

isFalsy(0);    // true
isFalsy(true); // false

➡️ implication(a: boolean, b: boolean)

Returns the result of a logical Implication (A → B) operation.

implication(true, false); // false
implication(false, true); // true

↔️ biConditional(a: boolean, b: boolean)

Returns the result of a logical Biconditional (A ↔ B) operation.

biConditional(true, true);   // true
biConditional(true, false);  // false

📄 License

This project is licensed under the ISC License.


📢 Author

Created by jella_komal.