Be careful with this. If I'm reading your code correctly, you are relying 
on the order of that object literal matching the order of the arguments 
object. This is not guaranteed, as far as I know. This would cause your 
arguments to be matched against the wrong schemas.

I'd suggest replacing the object input with an array input where order is 
guaranteed.

On Sunday, 17 March 2013 05:23:29 UTC+11, chakrit wrote:
>
> If you are like me and you write a lot of precondition checks in your 
> functions to validate the arguments,
> then I think you will like this module, here's a sample of what it can do:
>
> var have = require('have');
>
> function safeFunc(id, options, callback) {
>   have(arguments,
>     { id       : 'string or number'
>     , options  : 'optional object'
>     , callback : 'function'
>     });
> }
>
> Basically a very short and concise DSL for validating arguments.
>
> Install with `npm install have --save`
>
> Head over to https://github.com/chakrit/have to check the README if you 
> are interested. : )
>
>
> - chakrit
> http://chakrit.net
>

-- 
-- 
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to