API Reference

Returns a partialized version of a function with some arguments already passed.

function partial<T extends (...args: any[]) => any>(
  func: T,
  ...args: (Parameters<typeof func>[number] | Falsy)[]
)
   
// Example:

const greet = (greeting: string, name: string) => greeting + " " + name;
const sayHello = partial(greet, "Hello")

sayHello("John") //=> "Hello John"