Logical NOT Function
npm install logical-notThe not function is an alphabetic analogue of the unary operator !.
It is used to increase the readability of the code.
Usage:
``js
import not from "logical-not";
// or import { not } from "logical-not";
if (not("foo".includes("bar"))) {
console.log("baz");
}
`
`ts
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
}
`
MIT License (see LICENSE` file).