mirror of
https://github.com/discourse/discourse.git
synced 2025-05-28 13:51:18 +08:00
FIX: forces boolean when content is only "true" && "false"
This commit is contained in:
@ -27,6 +27,19 @@ export default Ember.Mixin.create({
|
||||
return !isNaN(parseFloat(input)) && isFinite(input);
|
||||
},
|
||||
|
||||
_cast(value) {
|
||||
if (value === this.noneValue) return value;
|
||||
return this._castInteger(this._castBoolean(value));
|
||||
},
|
||||
|
||||
_castBoolean(value) {
|
||||
if (this.get("castBoolean") && Ember.isPresent(value) && typeof(value) === "string") {
|
||||
return value === "true";
|
||||
}
|
||||
|
||||
return value;
|
||||
},
|
||||
|
||||
_castInteger(value) {
|
||||
if (this.get("castInteger") && Ember.isPresent(value) && this._isNumeric(value)) {
|
||||
return parseInt(value, 10);
|
||||
|
Reference in New Issue
Block a user