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