Univention Bugzilla – Bug 50490
univention-web/js/tools.js: isTrue() is only a negation of isFalse()
Last modified: 2019-11-13 12:36:38 CET
univention-web/js/tools.js contains a isFalse() and a isTrue() method. But isTrue() is only a negation of isFalse(). I think this is suboptimal if "input" is e.g. the value "manually". We should check explicitly for the corresponding "true" values like in isFalse(). isFalse: function(/*mixed*/ input) { if (typeof input === "string") { switch (input.toLowerCase()) { case 'no': case 'not': case 'false': case '0': case 'disable': case 'disabled': case 'off': return true; } } if (false === input || 0 === input || null === input || undefined === input || '' === input) { return true; } return false; }, isTrue: function(/*mixed*/ input) { //('yes', 'true', '1', 'enable', 'enabled', 'on') return !this.isFalse(input); },