RunKit + npm: @standard-software/parts

node v10.24.1
endpointsharetweet
var parts = require("@standard-software/parts") const arrayOriginal = [["a",100],["b",200],["a",300]] const result = parts.array.group(arrayOriginal, v => v[0], true); console.log(result); const arrayResult = []; result.index.forEach((v, i) => { arrayResult.push([v, parts.array.sum(result.result[i].map(v => v[1]))]) }) console.log(arrayResult);
Created from: https://npm.runkit.com/%40standard-software%2Fparts
Loading…