this post was submitted on 21 Oct 2024
86 points (86.4% liked)
Programming
17354 readers
535 users here now
Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!
Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.
Hope you enjoy the instance!
Rules
Rules
- Follow the programming.dev instance rules
- Keep content related to programming in some way
- If you're posting long videos try to add in some form of tldr for those who don't want to watch videos
Wormhole
Follow the wormhole through a path of communities !webdev@programming.dev
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Code before:
Here's how I would refac it for my personal readability. I would certainly introduce class types for some concern structuring and not dangling functions, but that'd be the next step and I'm also not too familiar with TypeScript differences to JavaScript.
Noteworthy:
password
is. (In C# I would use a param label on callvalidatePassword(plainPassword: user.password)
which would make the interface expectation and label transformation from interface to logic clear.Structurally, it's not that different from the post suggestion. But it doesn't truth-able value interpretation, and it goes a bit further.