Currently, I'm attempting to construct an array of JSON objects using TypeScript. Here is my current method:
const queryMutations: any = _.uniq(_.map(mutationData.result, function (mutation: Mutation) {
if (mutation && mutation.gene) {
const item = { facet: "MUTATION", term: mutation.gene + " " + mutation.proteinChange };
return item;
} else {
return {};
}
}));
const jsonString = JSON.stringify(queryMutations);
I would like to know if this approach is the most effective way to achieve this task. Any suggestions or feedback are greatly appreciated.