gka / d3-jetpack

🚀 Nifty convenience wrappers that speed up your daily work with d3.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How about d3.indexBy(array, key)

gka opened this issue · comments

Identical behaviour as in _.indexBy.

var indexed = d3.nest()
  .key(d => d.FIPS)
  .rollup(values => values[0])
  .object(data);

would become

var indexed = d3.indexBy(data, d => d.FIPS);

I'm ambivalent.

I usually include underscore so wouldn't use this too much. And where do we draw the line on which underscore functions not to include?

On the other hand, I basically only use _.indexBy, _.min, _.sortBy and _.debounce which isn't a lot...

agreed. let's keep using underscore