You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
550 B
18 lines
550 B
1 year ago
|
import {Selection} from "./index";
|
||
|
import selectorAll from "../selectorAll";
|
||
|
|
||
|
export default function(select) {
|
||
|
if (typeof select !== "function") select = selectorAll(select);
|
||
|
|
||
|
for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j = 0; j < m; ++j) {
|
||
|
for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {
|
||
|
if (node = group[i]) {
|
||
|
subgroups.push(select.call(node, node.__data__, i, group));
|
||
|
parents.push(node);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return new Selection(subgroups, parents);
|
||
|
}
|