Socket
Socket
Sign inDemoInstall

boolbase

Package Overview
Dependencies
0
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Protect your apps from supply chain attacks

Install

boolbase

two functions: One that returns true, one that returns false

    1.0.0latest
    npm

Version published
Maintainers
1
Weekly downloads
20,968,513
increased by2.29%

Weekly downloads

Package description

What is boolbase?

The boolbase npm package is a very simple utility library that provides two basic functions: one that always returns true and another that always returns false. These functions can be used as default or placeholder callbacks, particularly in scenarios where a truthy or falsy value is needed to determine the flow of logic.

What are boolbase's main functionalities?

Always return true

This feature provides a function that, when called, will always return the boolean value true. It can be used in situations where a callback is required that always approves or passes a condition.

const { trueFunc } = require('boolbase');
console.log(trueFunc()); // outputs: true

Always return false

This feature provides a function that, when called, will always return the boolean value false. It can be used in situations where a callback is required that always rejects or fails a condition.

const { falseFunc } = require('boolbase');
console.log(falseFunc()); // outputs: false

Other packages similar to boolbase

Readme

Source

#boolbase This very simple module provides two basic functions, one that always returns true (trueFunc) and one that always returns false (falseFunc).

###WTF?

By having only a single instance of these functions around, it's possible to do some nice optimizations. Eg. CSSselect uses these functions to determine whether a selector won't match any elements. If that's the case, the DOM doesn't even have to be touched.

###And why is this a separate module?

I'm trying to modularize CSSselect and most modules depend on these functions. IMHO, having a separate module is the easiest solution to this problem.

Keywords

FAQs

Last updated on 15 Feb 2014

Did you know?

Socket installs a GitHub app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc