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

1.0.5 • Public • Published

if-not

a package that helps you to check if a condition is false without excessive use of !


installation:

npm install if-not



example with and without if-not:

// with if-not:
import ifnot from "if-not";

ifnot(false, console.log, "Hello world!", "second argument!");
ifnot(true, console.log, "this won't be executed!");

// without if-not: look at all the bangs! all the indentation! this is unacceptable!
if(!false) {
	console.log("Hello world!", "second argument!");
}
if(!true) {
	console.log("this won't be executed");
}

output for both:

$ node .
Hello world! second argument!

Package Sidebar

Install

npm i if-not

Weekly Downloads

2

Version

1.0.5

License

MIT

Unpacked Size

4.31 kB

Total Files

9

Last publish

Collaborators

  • gdor11