Caches the result of a function based on the change of arguments.

  • Type Parameters

    • T extends (...args: A) => any

      The type of the function to be cached.

    • A extends any[]

      The type of the arguments of the function.

    Parameters

    • changed: (prevArgs: A, currentArgs: A) => boolean

      Function to determine if the arguments have changed.

    • run: T

      The function to be cached.

    Returns T & IClearable

    • The cached function with additional clear method.