Search code snippets, questions, articles...

Javascript Map and Filter together

data
    .filter(item => item.workFrontAnomalyTypeId === this.WorkFrontAnomalyTypeId)
    .map(anomaly => ({
        name: anomaly.name,
        id: anomaly.id,
        active: anomaly.active,
        workFrontAnomalyTypeId: anomaly.workFrontAnomalyTypeId,
        impedative: anomaly.impedative
    }));
Was this helpful?
0 Comments