mbostock/d3 — pull request #1256 by krikrou (2013-05-19 21:28:28+00:00)
Title: add nest.apply function

I sometimes need a way to modify {key: id , values : [] } nested objects.

usage :
yields = [{yield: 27.00, variety: "Manchuria", year: 1931, site: "University Farm"},
{yield: 48.87, variety: "Manchuria", year: 1931, site: "Waseca"},
{yield: 27.43, variety: "Manchuria", year: 1931, site: "Morris"}]

nest = d3.nest()
.key(function(d) { return d.year; })
.key(function(d) { return d.variety; })
.apply(function(o,depth) {o.text = 'title : ' + o.key ; })
.entries(yields);

Cheers
C.