Function constant

  • Creates a function that returns value.

    Type Parameters

    • T

    Parameters

    • Optionalvalue: T

      The value to return from the new function.

    Returns (() => T)

    Returns the new constant function.

      • (): T
      • Returns T

    5.0.0

    var objects = times(2, constant({ 'a': 1 }));

    console.log(objects);
    // => [{ 'a': 1 }, { 'a': 1 }]

    console.log(objects[0] === objects[1]);
    // => true