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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@falsejs/falsejs

v4.1.3

Published

Returns false.

Readme

FalseJS

Better than the keyword itself.

Ever wondered what would happen if JavaScript changed the false keyword to something else, like no, nope, noway, or something else? Chaos. That is what FalseJS is for. At the very beginning of the code, it checks if false and true don't exist, and if it does, it redefines them. That's one of the main reasons to use this library, if false doesn't exist, this will still work (hopefully).

The 10 attempts to get the value of false ensure that if one fails, it will go on to the next, so if JavaScript breaks one, there will still be more attempts. This is an alternative to the library false by mde, which uses the hardcoded boolean value false (which I believe they are trying to resolve on the sister library true, which will probably be passed down to the false library), and is way too short. FalseJS is way better. It includes checks for whether your computer is on fire as well, just in case it is on fire.

If you're looking for a more lightweight package that returns false, use false-value.

Installation

Install FalseJS with your favorite package manager.

NPM: npm install @falsejs/falsejs

Yarn: yarn add @falsejs/falsejs

PNPM: pnpm add @falsejs/falsejs

Import it with require:

const falsejs = require("@falsejs/falsejs").default

Import it with import:

import falsejs from "@falsejs/falsejs"

Usage

falsejs.False is a function that calculates the boolean value false and returns it. It takes three arguments.

function False(
  loggingEnabled?: "yes" | "no",
  shouldDoSomethingAsync?: "yes" | "no",
  shouldDoSomethingAsyncWithIsTenThousand?: "yes" | "no",
  disableAprilFoolsSideEffects?: "yes" | "no",
  definitelyDisableAprilFoolsSideEffects?: "yes" | "no",
  strictDisableAprilFoolsSideEffectsCheck?: "yes" | "no"
): boolean

The first argument is loggingEnabled, which is whether to output useful and funny logs or not. This can be "yes" or "no". Some logs may still be output even when you pass in "no", because FalseJS uses other libraries that may log things without user consent. "yes" and "no" are basically true and false, except the whole reason you're calling the function is to get a boolean, so it wouldn't make sense to pass in a boolean.

The second argument, shouldDoSomethingAsync, is whether FalseJS should do an asyncronhous promise-based setTimeout and when it's done, if logging is enabled, output [falsejs] Did something async in green. This is just a pointless feature that is by default "no", because it can be "yes" or "no".

The third argument, shouldDoSomethingAsyncWithIsTenThousand, is whether is-ten-thousand, a package used by FalseJS, should have an asynchronous promise-based setTimeout before it checks if a value is 10,000. It can be "yes" or "no".

The fourth and fifth arguments, disableAprilFoolsSideEffects and definitelyDisableAprilFoolsSideEffects, can be "yes" or "no". Both of them have to be "yes" to bypass the side effects of it being April Fools? What side effects, you may ask? Well, let's just say, FalseJS does something different on April Fools. If these are enabled when it's not April Fools, then an error will be thrown, unless the sixth argument, strictDisableAprilFoolsSideEffectsCheck, is "no".

And the last argument is the compatibility mode argument. This one has its own section about how it works which is after the example.

Example

const falsejs = require("@falsejs/falsejs").default
const falseValue = falsejs.False("yes", "yes", "yes", "yes", "yes", "no", falsejs.COMPATIBILITY_MODE.NONE) // outputs a bunch of logs

console.log(falseValue) // outputs false

Legacy Compatibility Modes

To ensure the integrity of the returned boolean across every known runtime environment since the dawn of the internet, the falsejs.False function supports an optional compatibilityMode argument. The checks performed may seem CPU-intensive and unnecessary, but they guarantee that the runtime environment is free of historical browser quirks that could threaten the stable return value of false.

Here's an example:

const myIE5CompatibleFalseValue = falsejs.False("yes", "yes", "yes", "yes", "yes", "no", falsejs.COMPATIBILITY_MODE.IE5) // Using IE5 compatibility mode

| Mode | Description | Possible Side Effects | |----------|----------|----------| | falsejs.COMPATIBILITY_MODE.NONE | Standard modern behavior | No side effects and extra checks for legacy compatibility. | | falsejs.COMPATIBILITY_MODE.IE5 | Activates JScript Engine Coercion Guard. Runs checks to ensure false is not improperly converted by an emulated 1999 environment. | May increase CPU usage to simulate JScript garbage collection. | | falsejs.COMPATIBILITY_MODE.NETSCAPE | Activates the JavaScript 1.1 Type Coercion Audit. Runs extensive type-coercion validation and audits the DOM for the deprecated Netscape <layer> tag. | May cause computer overload due to repetitive type-coercion audits, and it may cause memory leaks due to not cleaning up JSDOM. | | falsejs.COMPATIBILITY_MODE.OPERA_PRESTO | Simulates the single-threaded nature of the Presto engine and audits the global state for known Opera non-standard features. | May cause memory leaks, and block CPU during a ~0ms latency. |

isFalse function

FalseJS also exports a function called isFalse, which returns true if the value is false, otherwise false. This can be used to test whether FalseJS worked and returned false (like it wouldn't, so there's no need to do that). falsejs.isFalse just takes in a value and returns true if the value is false.

It takes in two parameters, the value to check whether it is false, and loggingEnabled which can be "yes" or "no".

Example:

const falsejs = require("@falsejs/falsejs").default
const falseValue = falsejs.False("yes", "yes", "yes", "yes", "yes", "no", falsejs.COMPATIBILITY_MODE.NONE)
const trueValue = require("true-value")

console.log(falsejs.isFalse(falseValue)) // true
console.log(falsejs.isFalse(false)) // probably true
console.log(falsejs.isFalse(trueValue)) // false
console.log(falsejs.isFalse("hi")) // false

falsejs.isFalse can also be used as an alternative to running the falsejs.False function and instead just passing a value that isn't false into falsejs.isFalse.

CLI

NPM:

npm install -g @falsejs/falsejs

Yarn:

yarn add -g @falsejs/falsejs

PNPM:

pnpm add -g @falsejs/falsejs

FalseJS provides a CLI.

$ npm install -g @falsejs/falsejs
$ false
false

jQuery plugin

A jQuery plugin is also provided for FalseJS. Here is an example:

const falsejs = require("@falsejs/falsejs").default
global.jQuery = require("jquery")
falsejs.injectIntojQuery()

const $ = jQuery

const myFalseValue = $.False("yes", "yes", "yes", "yes", "yes", "no", falsejs.COMPATIBILITY_MODE.NONE)
console.log(myFalseValue) // false
console.log($.isFalse(myFalseValue)) // true

Express middleware

Express middleware is also exported. Here is an example:

const express = require("express")
const falsejs = require("@falsejs/falsejs").default
const Bro = require("brototype")

const app = express()
const PORT = Bro(process).doYouEven("env.PORT") ? process.env.PORT : 3000

app.use(falsejs.expressMiddleware)

app.get("/", (req, res) => {
  res.send(req.isFalse(req.False("yes", "yes", "yes", "yes", "yes", "no", falsejs.COMPATIBILITY_MODE.NONE)) // sends true to the client
})

app.listen(PORT)

April Fools Behavior

Not April Fools Day

  • FalseJS will return false by default.
  • The flags disableAprilFoolsSideEffects and definitelyDisableAprilFoolsSideEffects do not affect the behavior of FalseJS. It behaves normally as it would on any non-April Fools' Day.
    • However, if strictDisableAprilFoolsSideEffectsCheck is not no" and instead "yes" (by default it's "yes"), it will throw an error if these options are set to "yes", because it's not April Fools' Day, and there are no side effects to disable.
    • If strictDisableAprilFoolsSideEffectsCheck is set to "no", FalseJS behaves normally without throwing an error, even if the side effect parameters are set to "yes".

April Fools Day

  • On April Fools' Day, FalseJS always returns true, regardless of the state of the flags.
  • To prevent this behavior, you must set both disableAprilFoolsSideEffects to "yes" and definitelyDisableAprilFoolsSideEffects to "yes" when you call FalsejS.
    • If these flags are set to "yes", FalseJS will return its expected behavior (return false), even on April Fools' Day.

Best Usage For April Fools Behavior

This usage ensures that you will always get false whether it's April Fools or not and no errors.

const falsejs = require("@falsejs/falsejs").default
const isAprilFools = require("is-april-fools")
const disableAprilFoolsSideEffects = isAprilFools() ? "yes" : "no"
const disableChecking = isAprilFools() ? "no" : "yes"

const falseValue = falsejs.False(
  "no",
  "no",
  "no" /*the first three options you can choose, for examples we set them all to "no"*/,
  disableAprilFoolsSideEffects,
  disableAprilFoolsSideEffects,
  disableChecking,
  falsejs.COMPATIBILITY_MODE.NETSCAPE // for this example we'll use netscape compatibility mode
)

// or you can do this, but the above is better

const falseValue = falsejs.False(
  "no",
  "no",
  "no" /*the first three options you can choose, for examples we set them all to "no"*/,
  "yes",
  "yes",
  "no",
  falsejs.COMPATIBILITY_MODE.NETSCAPE // for this example we'll use netscape compatibility mode
)

Important

Note: Installing FalseJS may show you a lot of deprecation warnings and vulnerabilities. This is normal, as FalseJS installs a total of more than 1000 dependencies. Don't worry, that's for a good reason - they're all used.

Other important note

In the console you may see this error:

Warning: React does not recognize the `getMember` prop on a DOM element. If you intentionally want it to appear in the DOM as a custom attribute, spell it as lowercase `getmember` instead. If you accidentally passed it from a parent component, remove it from the DOM element.
    at div
    at NoComponent

This is normal. Do not worry. FalseJS uses a package called get-member that adds a getMember method to every object. React elements are objects, so it gets confused. You may wonder why there's a React error even if you're not using React, but FalseJS uses React.

Tests

FalseJS uses multiple libraries for testing. Run npm test to test FalseJS.

Related Projects

License

FalseJS uses the EGPSL10X-1.0 license

made with HEAVY BLACK HEART U+2764