Skip to content

Conversation

@Fil
Copy link
Contributor

@Fil Fil commented May 14, 2021

fixes #357

src/plot.js Outdated
const scaled = scaleChannels.get(scale);
const {percent, transform = percent ? x => x * 100 : undefined} = options[scale] || {};
if (transform !== undefined) channel.value = Array.from(channel.value, transform);
if (typeof transform === "function") channel.value = Array.from(channel.value, transform);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn’t mean we should silently ignore a invalid argument, like if you pass a transform object instead of a function. Instead I meant we should consider null and undefined to be equivalent here. I’ll make the change and merge.

@mbostock mbostock force-pushed the fil/null-scale-transform-357 branch from 71e22e1 to 2b5c819 Compare July 31, 2021 15:46
@mbostock mbostock changed the title ignore non-function transform ignore null transform Jul 31, 2021
@mbostock mbostock merged commit 4dabda0 into main Jul 31, 2021
@mbostock mbostock deleted the fil/null-scale-transform-357 branch July 31, 2021 15:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A null scale transform should be equivalent to undefined.

3 participants