Skip to content

Commit 93a34a4

Browse files
Filmbostock
andauthored
ignore undefined outputs (#1230)
* ignore undefined outputs * tweak style Co-authored-by: Mike Bostock <mbostock@gmail.com>
1 parent c9c2812 commit 93a34a4

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/transforms/group.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,11 @@ export function maybeOutputs(outputs, inputs) {
174174
// Propagate standard mark channels by default.
175175
if (inputs.title != null && outputs.title === undefined) entries.push(["title", reduceTitle]);
176176
if (inputs.href != null && outputs.href === undefined) entries.push(["href", reduceFirst]);
177-
return entries.map(([name, reduce]) => {
178-
return reduce == null ? {name, initialize() {}, scope() {}, reduce() {}} : maybeOutput(name, reduce, inputs);
179-
});
177+
return entries
178+
.filter(([, reduce]) => reduce !== undefined)
179+
.map(([name, reduce]) => {
180+
return reduce === null ? {name, initialize() {}, scope() {}, reduce() {}} : maybeOutput(name, reduce, inputs);
181+
});
180182
}
181183

182184
export function maybeOutput(name, reduce, inputs) {

0 commit comments

Comments
 (0)