I have an existing codebase that uses AngularJS, Redux and Underscore. In that codebase I have the following code:
const selectedBroker = _.findWhere(state.brokers, { brokerId: action.payload });
return state.merge({
selectedBroker,
selectedBrokerId: action.payload,
});
I want to convert it to an es6 Method. I think the find()
, would be suitable, but don't know how. Could you help me a little bit? Thanks!!
Also it is not in the scope of this task but I see more underscore methods here. Like _.reject, _.contains, _.map
. Could you also convert that in the context similar to the above code example.