Skip to content

Commit

Permalink
Merge pull request #2097 from jasonandjay/opt-decompile
Browse files Browse the repository at this point in the history
 perfs: optimize script.decomplie return type
  • Loading branch information
junderw committed May 17, 2024
2 parents 6396fb4 + 7efa3f9 commit eb12504
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,9 @@ function toASM(chunks) {
if (chunksIsBuffer(chunks)) {
chunks = decompile(chunks);
}
if (!chunks) {
throw new Error('Could not convert invalid chunks to ASM');
}
return chunks
.map(chunk => {
// data?
Expand Down
4 changes: 3 additions & 1 deletion ts_src/script.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,9 @@ export function toASM(chunks: Buffer | Array<number | Buffer>): string {
if (chunksIsBuffer(chunks)) {
chunks = decompile(chunks) as Stack;
}

if (!chunks) {
throw new Error('Could not convert invalid chunks to ASM');
}
return chunks
.map(chunk => {
// data?
Expand Down

0 comments on commit eb12504

Please sign in to comment.