Skip to content

ignore null transform #403

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 31, 2021
Merged

ignore null transform #403

merged 1 commit into from
Jul 31, 2021

Conversation

Fil
Copy link
Contributor

@Fil Fil commented May 14, 2021

fixes #357

src/plot.js Outdated
@@ -35,7 +35,7 @@ export function plot(options = {}) {
if (scale !== undefined) {
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.
2 participants