The Mister Nester tool you link to is running d3 version 3. From the version 3 docs:[, mapType])

Applies the nest operator to the specified array, returning an associative array.

That's a plain old javascript object, which does not have a .each method.

The closest to what you want in version 3 is:

   .key(function(d) { return d.year; })
   .forEach(function(values, key) { return 0;});

Related Query

More Query from same tag