|
Last change
on this file since e4c61dd was e4c61dd, checked in by istevanoska <ilinastevanoska@…>, 5 months ago |
|
Prototype 1.1
|
-
Property mode
set to
100644
|
|
File size:
568 bytes
|
| Line | |
|---|
| 1 | // Given something array like (or null), returns something that is strictly an
|
|---|
| 2 | // array. This is used to ensure that array-like objects passed to d3.selectAll
|
|---|
| 3 | // or selection.selectAll are converted into proper arrays when creating a
|
|---|
| 4 | // selection; we don’t ever want to create a selection backed by a live
|
|---|
| 5 | // HTMLCollection or NodeList. However, note that selection.selectAll will use a
|
|---|
| 6 | // static NodeList as a group, since it safely derived from querySelectorAll.
|
|---|
| 7 | export default function array(x) {
|
|---|
| 8 | return x == null ? [] : Array.isArray(x) ? x : Array.from(x);
|
|---|
| 9 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.