or
Performs a logical OR operation on the given arguments.
1. Code
/**
* Performs a logical OR operation on the given arguments.
*
* @param args - The arguments to perform the OR operation on.
* @returns The result of the OR operation.
*/
const or = (...args: any[]) => {
return args.some((arg) => Boolean(arg));
};
export default or;
2. Installation
npx @jrtilak/lazykit@latest add or -undefined
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