Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

loadash pick property from object by different name

var arr = [
{"id":1,"name":"Name1","status":"active","account_id":"2KGGALS2353255"},
{"id":2,"name":"Name2","status":"active","account_id":"4ABCLS2353255"},
{"id":3,"name":"Name3","status":"active","account_id":"6LMNALS2353255"}
];

var result = arr.map(function(obj) {
  return {
    core: _.pick(obj, ['id', 'name']),
    extra: _.omit(obj, ['id', 'name'])
  };
});

console.log(result);
Comment

PREVIOUS NEXT
Code Example
Javascript :: remove property from query string javascript 
Javascript :: javascript map shorthand 
Javascript :: Angular bind only when mouse moves 
Javascript :: how to write text with javascript 
Javascript :: javascript check if input is empty 
Javascript :: too many rerenders 
Javascript :: get current month first date and last date in javascript 
Javascript :: javascript regex tester online 
Javascript :: react foreach loop 
Javascript :: button type submit process before submit 
Javascript :: create json object with multiple arrays 
Javascript :: Search products from an array by keywords in javascript 
Javascript :: how to pass string in javascript function 
Javascript :: p5 colored line 
Javascript :: unique id generator javascript 
Javascript :: undo pwa 
Javascript :: nodejs process object 
Javascript :: get gravatar javascript 
Javascript :: remove console messages of react-i18next 
Javascript :: how to turn a multiple dimensional object into single array 
Javascript :: angular show text in template before data loads 
Javascript :: how to empty nodeList 
Javascript :: Exponent Power Shorthand in javascript 
Javascript :: javascript unicode literal 
Javascript :: javascript Big decimal 
Javascript :: "when.promise" async await 
Javascript :: slice method javascript 
Javascript :: axios with load more 
Javascript :: javascript date set day of week 
Javascript :: _this2.setstate is not a function 
ADD CONTENT
Topic
Content
Source link
Name
7+6 =