Skip to content

Commit

Permalink
fix: support values of 0 in stroke-dasharray (#2721)
Browse files Browse the repository at this point in the history
  • Loading branch information
cfhull authored Apr 23, 2024
1 parent 67c265a commit 713690c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/pretty-humans-add.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@react-pdf/pdfkit": patch
---

fix: support values of `0` in stroke-dasharray
4 changes: 2 additions & 2 deletions packages/pdfkit/src/mixins/vector.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,12 @@ export default {
length = [length, options.space || length];
}

const valid = length.every((x) => Number.isFinite(x) && x > 0);
const valid = length.every((x) => Number.isFinite(x) && x >= 0);
if (!valid) {
throw new Error(
`dash(${JSON.stringify(originalLength)}, ${JSON.stringify(
options
)}) invalid, lengths must be numeric and greater than zero`
)}) invalid, lengths must be numeric and greater than or equal to zero`
);
}

Expand Down

0 comments on commit 713690c

Please sign in to comment.