• Shorthand to find objects with a property value

    Parameters

    • prop: string

      Property to compare (Dot nation supported)

    • value: any

      Value property must have

    Returns ((v: any) => boolean)

    Function used by filter or find

      • (v): boolean
      • Parameters

        • v: any

        Returns boolean

    const found = [
    {name: 'Batman'},
    {name: 'Superman'},
    ].filter(findByProp('name', 'Batman'));