-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix d3#2031 - Create a map from an array.
The d3.map constructor can now be used to index the elements of an array by an optional key function, providing a convenient (and faster) alternative to using d3.nest. Before: var objectByKey = d3.nest() .key(function(d) { return d.key; }) .rollup(function(values) { return values[0]; }) .map(objects, d3.map); After: var objectByKey = d3.map(objects, function(d) { return d.key; }); Note that the behavior of the d3.map constructor now changes slightly when a sparse array is used. Previously, missing elements from sparse arrays were skipped by the for-in loop, but now missing elements are indexed.
- Loading branch information
Showing
4 changed files
with
37 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters