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

Refactor parseShapes function to simplify property checks and improve readability #1709

Closed
Closed
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
12 changes: 3 additions & 9 deletions lib/udt.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,20 +160,14 @@ const parseShapes = (buffer, count, properties) => {
return shapes
}

if (properties.P) {
if (properties.P || properties.L) {
shapes.push({
parentOffset: -1,
figureOffset: 0,
type: 0x01
})
} else if (properties.L) {
shapes.push({
parentOffset: -1,
figureOffset: 0,
type: 0x02
type: properties.P ? 0x01 : 0x02
})
} else {
for (let i = 1; i <= count; i++) {
for (let i = 0; i < count; i++) {
shapes.push({
parentOffset: buffer.readInt32LE(buffer.position),
figureOffset: buffer.readInt32LE(buffer.position + 4),
Expand Down