Options
All
  • Public
  • Public/Protected
  • All
Menu

Module object/propApply

Index

References

Functions

References

Renames and re-exports propApply

Functions

  • propApply<K, R, O>(prop: K, fn: ObjBase<K, O[K], R>, obj: O): R
  • propApply<K, V, R>(prop: K, fn: ObjBase<K, V, R>, obj: any): R
  • propApply<K, V, R>(prop: K, fn: ObjBase<K, V, R>): (obj: any) => R
  • propApply<K>(prop: K): { <V, R>(fn: ObjBase<K, V, R>, obj: any): R; <V, R>(fn: ObjBase<K, V, R>): (obj: any) => R }
  • Returns the result of fn with value of property in obj.

    example
     propApply('a', x => 'is ' + x, {a: 2}); //=> is 2
    propApply('b', x => x > 0, {b: 2}); //=> true

    Type parameters

    • K: string | number | symbol

    • R

    • O: Record<K, any>

    Parameters

    • prop: K
    • fn: ObjBase<K, O[K], R>

      function to apply

    • obj: O

      The object to retrieve the property from.

    Returns R

    result of calling fn with property.

  • Returns the result of fn with value of property in obj.

    example
     propApply('a', x => 'is ' + x, {a: 2}); //=> is 2
    propApply('b', x => x > 0, {b: 2}); //=> true

    Type parameters

    • K: string | number | symbol

    • V

    • R

    Parameters

    • prop: K
    • fn: ObjBase<K, V, R>

      function to apply

    • obj: any

      The object to retrieve the property from.

    Returns R

    result of calling fn with property.

  • Returns the result of fn with value of property in obj.

    example
     propApply('a', x => 'is ' + x, {a: 2}); //=> is 2
    propApply('b', x => x > 0, {b: 2}); //=> true

    Type parameters

    • K: string | number | symbol

    • V

    • R

    Parameters

    • prop: K
    • fn: ObjBase<K, V, R>

      function to apply

    Returns (obj: any) => R

    result of calling fn with property.

      • (obj: any): R
      • Parameters

        • obj: any

        Returns R

  • Returns the result of fn with value of property in obj.

    example
     propApply('a', x => 'is ' + x, {a: 2}); //=> is 2
    propApply('b', x => x > 0, {b: 2}); //=> true

    Type parameters

    • K: string | number | symbol

    Parameters

    • prop: K

    Returns { <V, R>(fn: ObjBase<K, V, R>, obj: any): R; <V, R>(fn: ObjBase<K, V, R>): (obj: any) => R }

    result of calling fn with property.

      • <V, R>(fn: ObjBase<K, V, R>, obj: any): R
      • <V, R>(fn: ObjBase<K, V, R>): (obj: any) => R
      • Type parameters

        • V

        • R

        Parameters

        Returns R

      • Type parameters

        • V

        • R

        Parameters

        Returns (obj: any) => R

          • (obj: any): R
          • Parameters

            • obj: any

            Returns R

Generated using TypeDoc