bitrinjani / castable

Castable library sanitizes dirty external data by casting all properties at runtime to the types specified at compile time.
27 stars 3 forks source link

Support expanded support for converting to boolean values. #3

Open jloveridge opened 6 years ago

jloveridge commented 6 years ago

Be a bit more permissive on what values will result in a true from the boolean conversion. Additionally this fixes an issue where an exception is thrown if the value being converted happens to be null.

// examples where this could have caused an exception
const booleanConversionThrows = {
  propIsNull: JSON.stringify({value: null}),
  propIsNaN: JSON.stringify({value: NaN}),
};
coveralls commented 6 years ago

Coverage Status

Coverage decreased (-5.8%) to 94.231% when pulling e0cc45dcd31e49a670d6004e3b4b1b0dad1f627e on gradecam:feature/expanded-boolean into 109f38a9ce4b65710ea42d3eb7e0760b36aa4e85 on bitrinjani:master.