Here you can find the source of toBool()
String.prototype.toBool = function() { return (/^true$/i).test(this); };
String.prototype.toBool = function() return this.toLowerCase() === 'true'; };
String.prototype.toBool = function() { switch(this.toLowerCase()) { case 'true': case 'yes': case '1': return true; case 'false': case 'no': case '0': case null: return false; default: return Boolean(this); };
String.prototype.toBoolOrString = function () { return this === 'true' ? true : this === 'false' ? false : this.toString(); };
String.prototype.toBoolean = function () { return this == 'true'; }; String.prototype.isBoolean = function () { return this === 'true' || this === 'false'; };