jorgebay/node-cassandra-cql — pull request #71 by DanielSmedegaardBuus (2014-03-20 15:15:19+00:00)
Title: Encode undefined value as null

Same as previously, this time with a test case, too ;)

Was also wondering if you'd accept a pull request for an attempt at casting values to their supposed type on mismatch in the encoder functions before throwing a type error? — e.g. in encodeInt, instead of

if (typeof value !== 'number') {
throw new TypeError(null, value, 'number');
}

then

if (typeof value !== 'number') {
value = +value;
if (typeof value !== 'number') {
throw new TypeError(null, value, 'number');
}
}

In 0.4.4 I don't get type errors for a hinted string integer, in 0.5.0 I do. It'd be nice to try a cast before erroring out. Would you accept a pull request with such changes?

Thanks :)