Skip to content

Commit

Permalink
refactor: simplify property checks in parseFigures function
Browse files Browse the repository at this point in the history
- Combined redundant checks for 'properties.P' and 'properties.L' into a single condition
- Removed unnecessary loop index adjustment, starting loop from 0 for clarity
  • Loading branch information
Ayoub-Mabrouk committed Nov 16, 2024
1 parent ea475b0 commit e9d9995
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions lib/udt.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,18 +128,13 @@ const parseFigures = (buffer, count, properties) => {
return figures
}

if (properties.P) {
figures.push({
attribute: 0x01,
pointOffset: 0
})
} else if (properties.L) {
if (properties.P || properties.L) {
figures.push({
attribute: 0x01,
pointOffset: 0
})
} else {
for (let i = 1; i <= count; i++) {
for (let i = 0; i < count; i++) {
figures.push({
attribute: buffer.readUInt8(buffer.position),
pointOffset: buffer.readInt32LE(buffer.position + 1)
Expand Down

0 comments on commit e9d9995

Please sign in to comment.