Open
Description
Pretty frequently I come across the problem of needing to check if an optional variable is true or false. The problem is that the server can send it as true
, false
, undefined
, "true"
, or "false"
. I added this mixin (based on this SO answer):
_.mixin({
isTrue: function(str) {
return JSON.parse((str || "false").toLowerCase());
}
});
Thoughts on adding this?
Metadata
Metadata
Assignees
Labels
No labels