d3 / d3-path

Serialize Canvas path commands to SVG.
https://d3js.org/d3-path
ISC License
196 stars 37 forks source link

coerce ccw to true or false to avoid inversions #22

Closed Fil closed 5 years ago

Fil commented 5 years ago

(fixes #21)

mbostock commented 5 years ago

I think !!ccw is more standard than !!+ccw. Any reason not to use the former?

Fil commented 5 years ago

It was for the case of "0".

"0" is currently triggering the bug, which means we're sure that no-one uses it, and either solution is fine. Removing the + will save one byte :)

mbostock commented 5 years ago

But "0" is a truthy value, and thus should be interpreted as true rather than false.

if ("0") {
  console.log("it’s true");
}
mbostock commented 5 years ago

Rebased and merged to master.