Options
All
  • Public
  • Public/Protected
  • All
Menu

Module object/prop

Index

References

Functions

References

Renames and re-exports prop

Functions

  • prop<K, O>(prop: K, obj: O): O[K]
  • prop<K>(prop: K, obj: any): undefined
  • prop<K>(prop: K): { <O>(obj: O): O[K]; (obj: any): undefined }
  • Returns a function that when supplied an object returns the indicated property of that object, if it exists.

    example
     prop('x', {x: 100}); //=> 100
    prop('x', {}); //=> undefined

    Type parameters

    • K: string | number | symbol

    • O: Record<K, any>

    Parameters

    • prop: K

      The property name

    • obj: O

      The object to query

    Returns O[K]

    The value at obj.p.

  • Returns a function that when supplied an object returns the indicated property of that object, if it exists.

    example
     prop('x', {x: 100}); //=> 100
    prop('x', {}); //=> undefined

    Type parameters

    • K: string | number | symbol

    Parameters

    • prop: K

      The property name

    • obj: any

      The object to query

    Returns undefined

    The value at obj.p.

  • Returns a function that when supplied an object returns the indicated property of that object, if it exists.

    example
     prop('x', {x: 100}); //=> 100
    prop('x', {}); //=> undefined

    Type parameters

    • K: string | number | symbol

    Parameters

    • prop: K

      The property name

    Returns { <O>(obj: O): O[K]; (obj: any): undefined }

    The value at obj.p.

      • <O>(obj: O): O[K]
      • (obj: any): undefined
      • Type parameters

        • O: Record<K, any>

        Parameters

        • obj: O

        Returns O[K]

      • Parameters

        • obj: any

        Returns undefined

Generated using TypeDoc