I have this code which use a lodash _.chain. I would like to simplify the code, not use lodash and do this in another way.
examObjectives = _.chain(objectives)
.where({ 'examId': exam })
.uniq(true, 'id')
.map(function (s): any { return { id: s.id, text: s.text, numberAndText: s.numberAndText }; })
.value();
Can someone give me some advice on how I could remove the dependency on lodash, the _.chain and code this making maximum use of the available javascript functions that can now be found in new browsers. Note I would like to use the built in filter and map functions and not use any external functions to create the examObjectives.
I hope someone can come up with some ideas. I am not so familiar with javascript so welcome the chance to learn.