I've done a lot of programming and this is definitely useful. I've come up with a few times but never follow through with using it. The jQuery core has a lot of argument type checking and should probably use something like this so it's cleaner and clear which arguments it accepts, but that's why it has docs. If you don't have docs, this is more useful. If you only accept 1 argument, usually options, eg. options = {myParam: 4, isThis: 10} so you can use it as such: myFunction({myParam: 10, isThis: function() {}}); then that's the case where I always want to use something like this. I don't like how argument lists can get long and polluted, eg. myFunctionDoesAwesome('with this', 'and this argument', null, null, 10, 20, 303, null, null, true); and so I would use 1 param options with default values, and in that case I want validation against each possible argument.
On Mon, Mar 18, 2013 at 7:31 PM, chakrit <konsh...@chakrit.net> wrote: > The use case is just to simplify arguments validation, which for me, is > getting repetitive and cumbersome in a project I'm currently building. > > So I wrote the module. > > Added an example.js here: > https://github.com/chakrit/have/blob/master/example.js if it'll helps. > > On Sunday, March 17, 2013 1:35:38 PM UTC+7, Pavel Kostenko wrote: >> >> Didn't get it, can you provide a real life use case with explanation? > > -- > -- > Job Board: http://jobs.nodejs.org/ > Posting guidelines: > https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines > You received this message because you are subscribed to the Google > Groups "nodejs" group. > To post to this group, send email to nodejs@googlegroups.com > To unsubscribe from this group, send email to > nodejs+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/nodejs?hl=en?hl=en > > --- > You received this message because you are subscribed to the Google Groups > "nodejs" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to nodejs+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en --- You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.