Closed extremeheat closed 3 years ago
mapper
sanitizeMappings
switch ("355") { case 355: ... }
"355" == 355
('true' == true)
Can you update the doc ?
Add what you exposed there https://github.com/ProtoDef-io/node-protodef/blob/master/doc/api.md#protodefcompiler
mapper
type now returns the number if mapping fails (avoids needing to map lots of unknown values)sanitizeMappings
now converts strings to numbers/booleans to match the logic in switch statements https://github.com/ProtoDef-io/node-protodef/blob/master/src/datatypes/compiler-conditional.js#L13 , previously mapping numbers would work because of type coercion:switch ("355") { case 355: ... }
=="355" == 355
however the same won't work for booleans :('true' == true)
returns false.