arrays - Add new field to an existing object javascript d3js -


add third attribute object.

var result = array.from(     grants.reduce((organ, grant) =>       organ.set(grant.organisation.name,         (organ.get(grant.organisation.name) || 0) + +grant.value),       new map()),     ([organization, sum]) => ({organization,sum})     ); 

i wanting add new field called id above result object. how can achieve that?

something like:([id, organization, sum]) => ({id, organization,sum})

but dont understand organ.set, organ.get @ , when try add parameter breaks.

the field willing add in grant.organisation.orgid place code


Comments

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -