windmill icon indicating copy to clipboard operation
windmill copied to clipboard

Refactored nested match expressions for TS parser.

Open dommyrock opened this issue 1 year ago • 4 comments

Refactored nested match expressions into inline pattern matching with the help of destructuring with early returns + guard clauses for improved readability and reduced nesting.

Don't have the whole project setup so i checked that lib still builds as normal.

cd ./backend/parsers/windmill-parser-ts
cago b

Hope it helps keep things more organized for the future work. Cool project btw :)


:rocket: This description was created by Ellipsis for commit 9feb15282b4e4de4e303992aa3a758f3efef5149

Summary:

Refactored nested match expressions in backend/parsers/windmill-parser-ts/src/lib.rs for improved readability and reduced nesting.

Key points:

  • Refactored nested match expressions in backend/parsers/windmill-parser-ts/src/lib.rs.
  • Introduced parse_type, match_label, and match_properties helper functions.
  • Improved readability and reduced nesting in tstype_to_typ function.
  • Verified that the library builds successfully with cargo build.

Generated with :heart: by ellipsis.dev

dommyrock avatar Jun 22 '24 21:06 dommyrock

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

github-actions[bot] avatar Jun 22 '24 21:06 github-actions[bot]

I have read the CLA Document and I hereby sign the CLA

dommyrock avatar Jun 22 '24 21:06 dommyrock

Thanks for your contribution! I'll test it properly this week. Is there a specific reason why you replaced map_while with filter_map? I would also suggest adding an indication in the function names that they are linked to the parsing of oneOfs.

hugocasa avatar Jun 23 '24 10:06 hugocasa

see my previous comment

You're correct , should be map_while() as it was. I Was playing around with few different ideas so i missed this :/ Also fixed naming as you suggested.

Thanks for the review!

dommyrock avatar Jun 24 '24 08:06 dommyrock