Guest User

Untitled

a guest
Dec 16th, 2017
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.26 KB | None | 0 0
  1. let _ = require('lodash');
  2.  
  3. //Input
  4. var input = [
  5. { key: '1', val: 'a' },
  6. { key: '2', val: 'b' },
  7. { key: '3', val: 'c' }
  8. ];
  9.  
  10. //Desired output
  11. {
  12. '1': 'a',
  13. '2': 'b',
  14. '3': 'c'
  15. }
  16.  
  17. //Current best solution
  18. _.fromPairs(_.map(input, i => [i.key, i.val]));
Add Comment
Please, Sign In to add comment