or
Performs a logical OR operation on the given arguments.
1. Code
const or = (...args: any[]) => {
return args.some((arg) => Boolean(arg));
};
export default or;
2. Installation
npx @jrtilak/lazykit@latest add or
3. Description
The or function is a utility function in TypeScript that performs a logical OR 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: true
console.log(or(false, true));
// Expected Output: true
console.log(or(false, false));
// Expected Output: false
console.log(or());
// Expected Output: false
console.log(or(1, "lazykit"));
// Expected Output: true