Skip to content

Commit

Permalink
chore(JavaScript): Drop optional chaining expression (#1338)
Browse files Browse the repository at this point in the history
some old compiler did not recognize the `?.` expression(sadly).
  • Loading branch information
bytemain authored Jan 12, 2024
1 parent 3c01fca commit 08899bb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
9 changes: 6 additions & 3 deletions javascript/packages/fury/lib/gen/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,13 @@ export const generate = (fury: Fury, description: TypeDescription) => {
const generator = new InnerGeneratorClass(description, new CodecBuilder(scope, fury), scope);

const funcString = generator.toSerializer();
const afterCodeGenerated = fury.config?.hooks?.afterCodeGenerated;
if (typeof afterCodeGenerated === "function") {
return new Function(afterCodeGenerated(funcString));
if (fury.config && fury.config.hooks) {
const afterCodeGenerated = fury.config.hooks.afterCodeGenerated;
if (typeof afterCodeGenerated === "function") {
return new Function(afterCodeGenerated(funcString));
}
}

return new Function(funcString);
};

Expand Down
2 changes: 1 addition & 1 deletion javascript/packages/fury/lib/writer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ export const BinaryWriter = (config: Config) => {
varUInt32,
varUInt64,
varInt64,
stringOfVarUInt32: config?.hps
stringOfVarUInt32: config && config.hps
? stringOfVarUInt32Fast()
: stringOfVarUInt32Slow,
bufferWithoutMemCheck,
Expand Down
2 changes: 1 addition & 1 deletion javascript/packages/fury/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@furyjs/fury",
"version": "0.5.5-beta",
"version": "0.5.6-beta",
"description": "A blazing fast multi-language serialization framework powered by jit and zero-copy",
"main": "dist/index.js",
"scripts": {
Expand Down

0 comments on commit 08899bb

Please sign in to comment.