nand
Performs a logical NAND operation on the given arguments.
1. Code
const nand = (...args: any[]) => {
if (args.length === 0) return false;
const and = args.every((arg) => Boolean(arg));
return !and;
};
export default nand;
2. Installation
npx @jrtilak/lazykit@latest add nand
3. Description
The and function is a utility function in TypeScript that performs a logical NAND operation on the given arguments.
4. Props
Prop
Type
Default Value
args*any[]---
5. Examples
import nand from ".";
console.log(nand(true, true));
// Expected Output: false
console.log(nand(true, false));
// Expected Output: true
console.log(nand());
// Expected Output: false
console.log(nand(1, "lazykit"));
// Expected Output: false