JSV
JSV copied to clipboard
Add type coercion option
New environment option "typeCoercionFns" accepting an object with functions for coercing values to expected types (typically converting strings to booleans or numbers). The functions' names must match their corresponding type (e.g. "boolean" or "number").
See "Type Coercion Option" test at the end of tests/tests3.js
for example usage.
This actually implements https://github.com/garycourt/JSV/issues/5.
Note: please use ?w=1
in the URL when checking out the diff to ignore whitespace differences (some lines ending with spaces have been trimmed).