Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "function/of"

Index

Functions

Functions

of

  • of<T>(returnValue: T): function
  • Creates a function which returns the value given


    Example:

    import { of } from "@thalesrc/js-utils/function"; const base = [1, 2, 5, {}, "x", "y"]; const mapTo = of("thales rocks"); const mapped = base.map(mapTo); // ["thales rocks", "thales rocks", "thales rocks", "thales rocks", "thales rocks", "thales rocks"]

    Function Static Example:

    import "@thalesrc/js-utils/function/static/of"; const base = [1, 2, 5, {}, "x", "y"]; const mapTo = Function.of("thales rocks"); const mapped = base.map(mapTo); // ["thales rocks", "thales rocks", "thales rocks", "thales rocks", "thales rocks", "thales rocks"]

    Type parameters

    • T

    Parameters

    • returnValue: T

      The value which created function returns

    Returns function

    A function which returns the returnValue

      • (...args: any[]): T
      • Parameters

        • Rest ...args: any[]

        Returns T

Generated using TypeDoc