Skip to content

Commit

Permalink
pretty test 2
Browse files Browse the repository at this point in the history
  • Loading branch information
volovyks committed Sep 21, 2021
1 parent 7feefc5 commit 5aabc06
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
14 changes: 8 additions & 6 deletions borsh-ts/index.ts
Expand Up @@ -310,16 +310,18 @@ function serializeStruct(schema: Schema, obj: any, writer: BinaryWriter) {
obj.borshSerialize(writer);
return;
}
const structSchema = schema.get(obj.constructor);







const structSchema = schema.get(obj.constructor);
if (!structSchema) {
throw new BorshError(`Class ${obj.constructor.name} is missing in schema`);
}






if (structSchema.kind === "struct") {
structSchema.fields.map(([fieldName, fieldType]: [any, any]) => {
serializeField(schema, fieldName, obj[fieldName], fieldType, writer);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -12,7 +12,7 @@
"pretest": "yarn build",
"lint": "eslint borsh-ts/**/*.ts",
"pretty": "prettier --write borsh-ts/**/*.ts package.json",
"pretty:check": "yarn pretty --check",
"pretty:check": "yarn prettier --loglevel error --check borsh-ts/**/*.ts package.json",
"fix": "eslint borsh-ts/**/*.ts --fix"
},
"repository": {
Expand Down

0 comments on commit 5aabc06

Please sign in to comment.