86
Self-documenting Code
(lackofimagination.org)
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
Follow the wormhole through a path of communities !webdev@programming.dev
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.