Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: improve code for tuple checks #353

Merged
merged 2 commits into from
Nov 23, 2023
Merged

refactor: improve code for tuple checks #353

merged 2 commits into from
Nov 23, 2023

Conversation

CJ42
Copy link
Collaborator

@CJ42 CJ42 commented Nov 9, 2023

What kind of change does this PR introduce (bug fix, feature, docs update, ...)?

Refactor

What is the current behaviour (you can also link to an open issue here)?

Current code base work fine, but not easy to understand the code behind the tuple logic.

What is the new behaviour (if this is a feature change)?

Improve the code for tuple checking by create internal methods to valid and extract tuple content.

Other information:

@codecov-commenter
Copy link

codecov-commenter commented Nov 9, 2023

Codecov Report

Merging #353 (3de6505) into develop (9640d9f) will decrease coverage by 0.32%.
Report is 15 commits behind head on develop.
The diff coverage is 83.92%.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

@@             Coverage Diff             @@
##           develop     #353      +/-   ##
===========================================
- Coverage    83.71%   83.40%   -0.32%     
===========================================
  Files           18       19       +1     
  Lines         1130     1139       +9     
  Branches       255      259       +4     
===========================================
+ Hits           946      950       +4     
  Misses          98       98              
- Partials        86       91       +5     
Files Coverage Δ
src/constants/constants.ts 100.00% <100.00%> (ø)
src/constants/interfaces.ts 100.00% <ø> (ø)
src/lib/decodeData.ts 83.78% <100.00%> (+1.96%) ⬆️
src/types/ERC725JSONSchema.ts 100.00% <100.00%> (ø)
src/lib/getDataFromExternalSources.ts 61.29% <33.33%> (-2.05%) ⬇️
src/lib/utils.ts 82.09% <81.81%> (-1.03%) ⬇️
src/lib/encoder.ts 82.52% <66.66%> (-1.43%) ⬇️

@CJ42 CJ42 changed the title refactor: extract to internal methods feat(wip): add support for more valueType Nov 9, 2023
@CJ42 CJ42 changed the title feat(wip): add support for more valueType refactor: improve code for tuple checks + add better typing for valueType Nov 9, 2023
@CJ42 CJ42 force-pushed the refactor/clean-code branch 3 times, most recently from 3de6505 to 9a8137a Compare November 9, 2023 19:35
@CJ42 CJ42 marked this pull request as ready for review November 9, 2023 19:36
@CJ42 CJ42 changed the title refactor: improve code for tuple checks + add better typing for valueType refactor: improve code for tuple checks Nov 10, 2023
Copy link
Contributor

@Hugoo Hugoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

if (regexMatch) {
bytesLengths.push(parseInt(regexMatch[1], 10));
}
if (regexMatch) bytesLengths.push(parseInt(regexMatch[1], 10));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

personal preference - but i prefer with brackets, i think it is easier to read and see it is an if


let valueTypeToDecode = valueType;
const extractTupleElements = (tupleContent: string): string[] =>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

@Hugoo Hugoo merged commit 7791977 into develop Nov 23, 2023
2 checks passed
@Hugoo Hugoo deleted the refactor/clean-code branch November 23, 2023 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants