Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const _ = require("lodash");
- // The source object
- var info = [
- { 'user': 'amit', 'age': 23 },
- { 'user': 'priya', 'age': 21 },
- { 'user': 'priya', 'age': 25 },
- ];
- // Using the _.mapKeys() method
- const newInfo=_.mapKeys(info,
- function(o) { return o.age; })
- console.log('info',newInfo["25"]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement