Closed tomwanzek closed 7 years ago
Yep, a bug. I’d probably change the assignment to:
rows.columns = columns || [];
I just pushed a PR to save you the trouble :smile: I thought the initialization could happen right when columns
is declared.
Both approaches should work, if you want me to change the PR to your fallback assignment, I could quickly change it. your call.
@mbostock I changed the PR to use the fallback approach: rows.columns = columns || [];
In the edge case where the to-be-parsed string passed into
xxxParse(...)
methods is empty, thecolumn
property of the returned parsed array isundefined
.Although this is an edge case, it seems preferable to return an empty array of column names for consistency.
(Thanks @azoson for pointing this behaviour out in DefinitelyTyped/DefinitelyTyped#21092 and DefinitelyTyped/DefinitelyTyped#21162 . cc @gustavderdrache)