Options
All
  • Public
  • Public/Protected
  • All
Menu

Module object/map

Index

References

Functions

References

Renames and re-exports map

Functions

  • map<O, R>(fn: ObjBaseBy<O, R>, obj: O): Record<keyof O, R>
  • map<K, V, R>(fn: ObjBase<K, V, R>): <O>(obj: O) => Record<keyof O, R>
  • Applies fn to each of the obj values, and returns new object.

    example
     var double = x => x * 2;

    map(double, {x: 1, y: 2, z: 3}); //=> {x: 2, y: 4, z: 6}

    Type parameters

    • O: Record<any, any>

    • R

    Parameters

    • fn: ObjBaseBy<O, R>

      The function to be called on every value of the input obj. Receives three argument, value, key, obj.

    • obj: O

      The object to be iterated over.

    Returns Record<keyof O, R>

    The new object.

  • Applies fn to each of the obj values, and returns new object.

    example
     var double = x => x * 2;

    map(double, {x: 1, y: 2, z: 3}); //=> {x: 2, y: 4, z: 6}

    Type parameters

    • K: string

    • V

    • R

    Parameters

    • fn: ObjBase<K, V, R>

      The function to be called on every value of the input obj. Receives three argument, value, key, obj.

    Returns <O>(obj: O) => Record<keyof O, R>

    The new object.

      • <O>(obj: O): Record<keyof O, R>
      • Type parameters

        • O: Record<any, any>

        Parameters

        • obj: O

        Returns Record<keyof O, R>

Generated using TypeDoc