Open captDaylight opened 6 years ago
Would be useful in unit testing. You could even test on the fly while a program is running with this.
+1 on the why, I need practical examples explaining the existance of this package.
current readme show's several Argument errors flying around when your variable isn't as string or has the right length...
however, am I supposed to now put catch blocks around any function call because it will start throwing errors on my data that I just fetched from a 3rd party service or a form?
This seems like something I don't want in my code, unless i'm a library dev that makes an addition method to add 2 numbers so i'm checking nobody tries to send me a string instead.
Form validation for instance https://github.com/SamVerschueren/ngx-ow.
Am I supposed to now put catch blocks around any function call because it will start throwing errors on my data that I just fetched from a 3rd party service or a form
To be honest, yes you should validate this data. Never trust data coming from an external source.
I beg to differ, you should only validate the properties you need in your application, otherwise your app breaks when irrelevant stuff is changed. however that was not the point of my question, I find it very obtrusive if i am to update all my functions with param validation lines while you could just validate the data comming and going in your app by implementing either classes or interfaces in typescript for your entities in the app, or validating the incomming data at service level with libs like JOI or yours here.
I would never go as far as merging a lib like ow or joi into the code within each function as it then requires you to catch errors that could be thrown from every function or am I seeing it wrong here?
This looks like an interesting project but I don't have a solid grasp of where I should use it. In general, more upfront overview would be helpful.