What is the best way to streamline the following code:
rules = rules.map(rule => Object.assign(rule, rule.ruleOption.options))
rules.forEach(rule => delete rule.ruleOption)
rules = _.keyBy(rules, 'code')
I have recently started using Lodash and am trying to properly understand how to use it effectively.