mbostock/d3 — pull request #1932 by lewis500 (2014-07-04 20:04:54+00:00)
Title: implemented keyName feature to name your keys in d3.nest. added tests.

A keyName option for d3.nest, whereby you can name the keys that come out when you call .entries(). the default key is "key". For example,

d3.nest()
.key(function(d) { return d[0]; })
.keyName('state')
.sortKeys(d3.descending)
.entries([['AL', 1999, 200], ['CA', 1999, 350], ['CA', 2009, 550], ['AL', 2009, 250]]);
will give you:

[
{state: "CA", values: [['CA', 1999, 350], ['CA', 2009, 550]]},
{state: "AL", values: [['AL', 1999, 200], ['AL', 2009, 250]]}
]