|
Last change
on this file since e4c61dd was e4c61dd, checked in by istevanoska <ilinastevanoska@…>, 6 months ago |
|
Prototype 1.1
|
-
Property mode
set to
100644
|
|
File size:
730 bytes
|
| Line | |
|---|
| 1 | import {Selection} from "./index.js";
|
|---|
| 2 | import array from "../array.js";
|
|---|
| 3 | import selectorAll from "../selectorAll.js";
|
|---|
| 4 |
|
|---|
| 5 | function arrayAll(select) {
|
|---|
| 6 | return function() {
|
|---|
| 7 | return array(select.apply(this, arguments));
|
|---|
| 8 | };
|
|---|
| 9 | }
|
|---|
| 10 |
|
|---|
| 11 | export default function(select) {
|
|---|
| 12 | if (typeof select === "function") select = arrayAll(select);
|
|---|
| 13 | else select = selectorAll(select);
|
|---|
| 14 |
|
|---|
| 15 | for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j = 0; j < m; ++j) {
|
|---|
| 16 | for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {
|
|---|
| 17 | if (node = group[i]) {
|
|---|
| 18 | subgroups.push(select.call(node, node.__data__, i, group));
|
|---|
| 19 | parents.push(node);
|
|---|
| 20 | }
|
|---|
| 21 | }
|
|---|
| 22 | }
|
|---|
| 23 |
|
|---|
| 24 | return new Selection(subgroups, parents);
|
|---|
| 25 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.