Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "utils/constant-function/docs/types/index.d"

Index

Functions

Functions

Export assignment constantFunction

  • constantFunction(value?: any): Function
  • Creates a function which always returns the same value.

    Notes

    • When provided an object reference, the returned function always returns the same reference.

    Parameters

    • Optional value: any

      value to always return

    Returns Function

    constant function

    Example

    var fcn = constantFunction( 3.14 );
    
    var v = fcn();
    // returns 3.14
    
    v = fcn();
    // returns 3.14
    
    v = fcn();
    // returns 3.14