79690098

Date: 2025-07-04 11:20:21
Score: 1
Natty:
Report link
function isZeroArgs(func: Function): func is () => unknown {
  return func.length === 0;
}

Example usage:

function sayHello() {
  return "Hello!";
}

function greet(name: string) {
  return `Hello, ${name}!`;
}

if (isZeroArgs(sayHello)) {
  sayHello(); // OK
}

if (isZeroArgs(greet)) {
  greet(); 
}
Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: DivyaHVG