@pengzhanbo/utils - v3.4.1
    Preparing search index...

    Function invoke

    • call the function

      调用函数

      Type Parameters

      • F extends Fn

      Parameters

      • fn: F

        The function to call. 要调用的函数

      • ...args: Parameters<F>

        The arguments to pass to the function. 要传递给函数的参数

      Returns void

      The result of the function call. 函数调用的结果

      const add = (a, b) => a + b
      invoke(add, 1, 2)
      // => 3
    • call every functions in an array, the remaining parameters are passed in turn

      调用数组中的每个函数,剩余参数依次传入

      Type Parameters

      • F extends Fn

      Parameters

      • fns: Nullable<F>[]

        An array of functions. 函数数组

      • ...args: Parameters<F>

        The arguments to pass to each function. 要传递给每个函数的参数

      Returns void

      undefined 无返回值

      const add = (a, b) => a + b
      invoke([add, add], 1, 2)