3 ms·
$ = function(foo) { return d3.selectAll(foo); }
by dheera 12y ago
$ = function(foo) { return d3.selectAll(foo); }
- chrtze 12y agoFrom my perspective I would rather have $.select() instead of $() because it makes more clear what this function actually does.
- ape4 12y agoFuture maintainers will hate that.
- Roboprog 12y agoDone as a global, then probably, yeah. If it's assigned at the beginning of a function as a local var, then used 5 or 6 times, probably no harm done.
- richardwhiuk 12y agoor $ = d3.selectAll; surely?
- prezjordan 12y agoYou also need to re-bind it to d3. $ = d3.selectAll.bind(d3); Since `this` in the `selectAll` will refer to whatever is before the period. When we reassign to `$` in `$ = d3.selectAll`, we lose that. Silly, isn't it? Demo: http://jsbin.com/guyisewexu/1/edit?js,console http://jsbin.com/guyisewexu/1/edit?js,console