Horje
Merger Douplicate array Code Example
Merger Douplicate array
var array = [{name:"foo1",value:"val1"},{name:"foo1",value:["val2","val3"]},{name:"foo2",value:"val4"}];

function mergeNames (arr) {
    return _.chain(arr).groupBy('name').mapValues(function (v) {
        return _.chain(v).pluck('value').flattenDeep();
    }).value();
}

console.log(mergeNames(array));




Javascript

Related
4.8. Input with readline-sync¶ Code Example 4.8. Input with readline-sync¶ Code Example
js Write a function that will return a random integer between 10 and 100 Code Example js Write a function that will return a random integer between 10 and 100 Code Example
js hangman with repeated characters Code Example js hangman with repeated characters Code Example
FTP Code Example FTP Code Example
check if a string matches a regex javascript Code Example check if a string matches a regex javascript Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
10