Useful JavaScript Functions - To Boolean
A quick snippet of useful JavaScript functions:
var CommonFunctions = function () {
function toBoolean(value) {
switch (value) {
case true:
case 'True':
case 'true':
case 1:
case '1':
return true;
break;
default:
return false;
break;
}
}
return {
toBoolean: function (value) {
return toBoolean(value);
}
}
}();