[SalesForce] Parse custom metadata in lightning component

I'd like to display 5 different values from a custom metadata type in a lightning component. Instead of doing 5 different Apex methods, I'd like to return them all at once and then display the values where appropriate.
I don't know how to "filter" results on the lightning component side – I can only find examples of displaying all the results in a list.

Helper:

       getInstitutionalMetrics : function (component, event, helper) {
    var action = component.get("c.queryAllMetrics");

    action.setCallback(this, function(response){
        component.set("v.allMetrics", response.getReturnValue());
    });
        $A.enqueueAction(action);
},

Component:

    <aura:attribute name="allMetrics" type="Metrics__mdt[]"/>

Class:

@AuraEnabled
public static List<Metrics__mdt> queryAllMetrics()
{

    List<Metrics__mdt> allMetrics = [SELECT DeveloperName, Value__c FROM Metrics__mdt 
                                                            WHERE Active__c = true];
    return allMetrics;

}

In the component, rather than displaying a list of results I need to selectively display DeveloperName A in location 1, DeveloperName B in location 2, etc.
Is there a way to do this?

DeveloperName A is: <lightning:formattedText value="{!v.allMetrics.Value__c where DeveloperName='A'? }" />

Best Answer

You can use the reduce function to map the values into an object you can use to refer to individual elements:

action.setCallback(this, function(response){
  var results = response.getReturnValue()
   .reduce((a,v) => { a[v.DeveloperName] = v; return a; }, {});
  component.set("v.metricMap", results);
});

At that point, you can refer to the individual items by name:

<lightning:formattedText value="{!v.metricMap.A.Value__c}" />

Note that the attribute type should be a Map, not a List.