Load Map to Different variable names

Alexandra :

Hi I get my loadash result using the following code

var acc = _.map(accounts, i => _.pick(i, 'id', 'number', 'transit'))

and get the result

{ id: '125658', number: '8143045', transit: '09060' }

Can I get the result in the following way

{ account_id: '125658', account_number: '8143045', account_transit: '09060' }
Klaycon :

Strange use case for lodash. Just use native js.

var acc = _.map(accounts, i => ({ account_id: i.id, account_number: i.number, account_transit: i.transit }));

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=31992&siteId=1