NewDash

    Function property

    • Creates a function that returns the value at path of a given object.

      Parameters

      • path: ArrayPath

        The path of the property to get.

      Returns Accessor

      5.0.0

      const objects = [
      { 'a': { 'b': 2 } },
      { 'a': { 'b': 1 } }
      ]

      map(objects, property('a.b'))
      // => [2, 1]

      map(sortBy(objects, property(['a', 'b'])), 'a.b')
      // => [1, 2]
    MMNEPVFCICPMFPCPTTAAATR