@geraintguan/ts-std-lib
    Preparing search index...

    Function constant

    • Returns a function that when called always returns the given value.

      Type Parameters

      • T

      Parameters

      • value: T

        The value that should be returned.

      Returns () => T

      A function that when called will always return the given value.

      const nine = constant(9);

      nine() // => 9
      nine() // => 9
      nine() // => 9