polymer
polymer copied to clipboard
Polymer.Base.deserialize for Boolean values
Description
I was trying to use Polymer.Base.deserialize (this.deserialize) to convert a string value to its original value type. It worked fine until I tried to convert "false" to false. It returns true all the time. I checked the method and I found this:
case Boolean:
value = value !== null;
I understand that value could be anything but wouldn't be better to add something like this?
case Boolean:
value = (value == 'false' || value == '0') ? false : value !== null;
Live Demo
https://jsbin.com/xerututizi/1/edit?html,output
Versions
- Polymer: v1.2.4
- webcomponents: v0.7.22
Closing this issue as deserialize has been deprecated and is now on the legacy element mixin.