logical-not
TypeScript icon, indicating that this package has built-in type declarations

1.0.9 • Public • Published

Logical NOT Function

The not function is an alphabetic analogue of the unary operator !. It is used to increase the readability of the code.

Usage:

import not from "logical-not";
// or import { not } from "logical-not";

if (not("foo".includes("bar"))) {
    console.log("baz");
}

Typescript support

function main(): void {
    const div = document.querySelector("div");
    // div is HTMLDivElement | null

    if (not(div)) return;
    // now div is HTMLDivElement

    div.textContent; // ok
    // ^ no 'possibly null' error
}

License

MIT License (see LICENSE file).

Readme

Keywords

Package Sidebar

Install

npm i logical-not

Weekly Downloads

19,449

Version

1.0.9

License

MIT

Unpacked Size

2.72 kB

Total Files

5

Last publish

Collaborators

  • paveldymkov