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
Post a Comment