Adding support of array argument in valid()

It's useful to make valid() handle array arguments, not only
seperated arguments.

Example usage case:

//This array will be used in other part of code,
//and number of payment method could be changed later.
//So, we will store list of valid payment methods in array.
var payment = ["visa", "mastercard", /*...*/];

var schema = {
    //not only accepts string arguments,
    //but also accepts arrays of valid cases
    payment: Joi.types.String().valid(payment),

    //here is an alternative form, much verbose than the upper
    payment: Joi.types.String().valid.apply(Joi.types.String(), payment),
}
fix typo
Bug fix: array.convert can handle string correctly

There is a bug in array.convert. array.convert should convert
string into array when given string is not a JSON format. If given
String is non-JSON format, array.convert should return an array
which contains the given string.

For example,

case 1: 1 -> [ 1 ]
case 2: '1' -> [ '1' ]
case 3: 'string' -> [ 'string' ]
case 4: "['string1', 'string2']" -> ['string1', 'string2']

To handle case 4, code uses JSON.parse to determine whether given
string is JSON format or not. However, JSON parse 1) converts
string into number when !isNaN(given_string), and 2) throws
exception when given_string is not JSON format and
isNaN(given_string).
As a result, above test cases was working like following.

case 1: 1 -> [ 1 ]
case 2: '1' -> [ 1 ]
case 3: 'string' -> undefined //returns nothing!
case 4: "['string1', 'string2']" -> ['string1', 'string2']

To solve the problem, I added 1) isNaN check before try JSON.parse
and 2) return [ given_string ] when JSON.parse throws error.
Add option to validate

when validate function is valled, it tries to convert given object
into configured type, and check constraints. However, it does not
convert object into configured type. This convertion should be
done in some place, so I think it's better to do it in joi.

To achive this, I added a option argument to validate. If convert
is true, validate converts given object to given configuration.

I believe this is useful when joi is used with hapi,
especially with query parsing.
fix typo
Merge pull request #49 from yjh0502/master

Adding support of array argument in valid()