Runkit
Runkit
home page
user forum
new notebook
clone notebook
download notebook
support & documentation
log in
sign up
new notebook
help & feedback
clone this notebook
download this notebook
Sign In
Sign Up
RunKit + npm: @standard-software/parts
node v10.24.1
endpoint
share
tweet
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…
Clone and edit this document