Options
All
  • Public
  • Public/Protected
  • All
Menu

Module function/identity

Index

References

Functions

References

Renames and re-exports identity

Functions

  • identity<T>(x: T): T
  • A function that does nothing but return the parameter supplied to it. Good as a default or placeholder function.

    example
     identity(1); //=> 1

    const obj = {};
    identity(obj) === obj; //=> true

    Type parameters

    • T

    Parameters

    • x: T

      The value to return.

    Returns T

    The input value, x.

Generated using TypeDoc