Skip to content

Commit

Permalink
Small bugfix for results map init in constructor.
Browse files Browse the repository at this point in the history
  • Loading branch information
FADY Jonathan committed Nov 10, 2023
1 parent b85c5f9 commit c6c1e06
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@jonathanfady/restructure",
"version": "1.9.0",
"version": "1.9.1",
"description": "Declaratively encode and decode binary data",
"type": "module",
"source": "./src/index.js",
Expand Down
4 changes: 2 additions & 2 deletions src/Struct.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export class Struct {
this.results.set(k, 0);
this.size += getNumberSize(value);
} else if ("length" in value) { // Array
this.results.set(k, new Array(value.size).fill(0));
this.results.set(k, new Array(value.length).fill(0));
this.size += value.size;
} else if ("flags" in value) { // Bitfield
for (const flag of value.flags) {
Expand All @@ -24,7 +24,7 @@ export class Struct {
}
this.size += value.size;
} else { // String
this.results.set(k, ' '.repeat(value.size));
this.results.set(k, '');
this.size += value.size;
}
}
Expand Down

0 comments on commit c6c1e06

Please sign in to comment.