Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let _ = require('lodash');
- //Input
- var input = [
- { key: '1', val: 'a' },
- { key: '2', val: 'b' },
- { key: '3', val: 'c' }
- ];
- //Desired output
- {
- '1': 'a',
- '2': 'b',
- '3': 'c'
- }
- //Current best solution
- _.fromPairs(_.map(input, i => [i.key, i.val]));
Add Comment
Please, Sign In to add comment