Skip to content
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

fix: support values of 0 in stroke-dasharray #2721

Merged
merged 2 commits into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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