Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

linkDistance and linkStrength called with no arguments return function, not value #895

Closed
ezyang opened this Issue · 3 comments

3 participants

@ezyang

As seen in this transcript:

> force.linkDistance
function (x) {
      if (!arguments.length) return linkDistance;
      linkDistance = d3_functor(x);
      return force;
    }
> force.linkDistance()
function () {
      return v;
    }
> force.linkDistance()()
40

This is not consistent with the other methods.

@jasondavies
Collaborator

This is expected because linkDistance and linkStrength can take functions as well as constants. If you specify a constant, it is converted to a function internally.

@mbostock
Owner

This is a valid bug, though; the code shouldn't expose the fact that it's converting constants to a function internally. I was just lazy.

@jasondavies
Collaborator

Ha! :)

@mbostock mbostock closed this in d287b63
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.