underscore.js - Merge multidimensional array using Underscorejs -


[{"ic_value1":"ptp-1","in_id":"80"},{"ic_value1":"ptp-2","in_id":"81"},{"ic_value1":"ptp-3a","in_id":"82"},{"ic_value1":"ptp-3b","in_id":"83"},{"ic_value1":"ptp-4","in_id":"84"},{"ic_value1":"ptp-5a","in_id":"85"},{"ic_value1":"ptp-5b","in_id":"86"},{"ic_value1":"ptp-6","in_id":"87"},{"ic_value1":"ptp-7","in_id":"88"},{"ic_value1":"ptp-8","in_id":"89"},{"ic_value1":"ptp-9a","in_id":"90"},{"ic_value1":"ptp-9b","in_id":"91"},{"ic_value1":"ptp-10","in_id":"92"},{"ic_value1":"ptp-11","in_id":"93"},{"ic_value1":"ptp-12a","in_id":"94"},{"ic_value1":"ptp-13","in_id":"95"},{"ic_value1":"ptp-13","in_id":"96"},{"ic_value1":"ptp-14","in_id":"97"},{"ic_value1":"ptp-15","in_id":"98"},{"ic_value1":"ptp-16","in_id":"99"},{"ic_value1":"dh-129","in_id":"100"},{"ic_value1":"dh-130","in_id":"101"}]  [{"ic_value1":"09+75","in_id":"80"},{"ic_value1":"09+75","in_id":"81"},{"ic_value1":"09+09","in_id":"82"},{"ic_value1":"09+09","in_id":"83"},{"ic_value1":"09+06","in_id":"84"},{"ic_value1":"08+08","in_id":"85"},{"ic_value1":"08+08","in_id":"86"},{"ic_value1":"08+08","in_id":"87"},{"ic_value1":"08+00","in_id":"88"},{"ic_value1":"07+10","in_id":"89"},{"ic_value1":"06+00","in_id":"90"},{"ic_value1":"06+00","in_id":"91"},{"ic_value1":"04+43","in_id":"92"},{"ic_value1":"10+99","in_id":"93"},{"ic_value1":"10+83","in_id":"94"},{"ic_value1":"03+84","in_id":"95"},{"ic_value1":"03+84","in_id":"96"},{"ic_value1":"04+52","in_id":"97"},{"ic_value1":"03+94","in_id":"98"},{"ic_value1":"04+54","in_id":"99"},{"ic_value1":"07+82","in_id":"100"},{"ic_value1":"07+42","in_id":"101"}]   [{"ic_value1":"112d","in_id":"80"},{"ic_value1":"190d","in_id":"81"},{"ic_value1":"096d","in_id":"82"},{"ic_value1":"096d","in_id":"83"},{"ic_value1":"184d","in_id":"84"},{"ic_value1":"092d","in_id":"85"},{"ic_value1":"092d","in_id":"86"},{"ic_value1":"190d","in_id":"87"},{"ic_value1":"040d","in_id":"88"},{"ic_value1":"040d","in_id":"89"},{"ic_value1":"010d","in_id":"90"},{"ic_value1":"010d","in_id":"91"},{"ic_value1":"017d","in_id":"92"},{"ic_value1":"060d","in_id":"93"},{"ic_value1":"020d","in_id":"94"},{"ic_value1":"007d","in_id":"95"},{"ic_value1":"007d","in_id":"96"},{"ic_value1":"024d","in_id":"97"},{"ic_value1":"048d","in_id":"98"},{"ic_value1":"050d","in_id":"99"},{"ic_value1":"095d","in_id":"100"},{"ic_value1":"080d","in_id":"101"}]  

how align 3 array row , column. every first item containing same in_id , want put row , column

expected output:

[{80: ["ptp-1","09+75","112d"]] 

something similar this

how achieve using underscorejs

since ids seem appear in every of 3 arrays in same order, it's simple as

_.map(_.zip(array1, array2, array3), function(row) {     var o = {};     o[row[0].in_id] = _.pluck(row, "ic_value1");     return o; }); 

Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -