Function that checks for truth value
I thought it might be faster to:


first merely evaluate the value "standard" truth with !!value
then add conditions for your special requirements (including 'false', not cited in your question but present in your code)


This way, it also reduces the code, like this:



var isTrue = function(value) {
  return (!!value &amp;&amp; value !== '0' &amp;&amp; value !== 'false'
    &amp;&amp; !!(typeof value !== 'object' || Object.keys(value).length));
}

console.log(false,isTrue(false));
console.log("'false'",isTrue('false'));
console.log(true,isTrue(true));
console.log(0,isTrue(0));
console.log(1,isTrue(1));
console.log("'0'",isTrue('0'));
console.log("'1'",isTrue('1'));
console.log("'test'",isTrue('test'));
console.log('{}',isTrue({}));
console.log('[]',isTrue([]));
console.log('Object',isTrue({a: 1}));
console.log('Array',isTrue([1]));




Now we can observe that it works more than 2 times faster.
Here an execution of the same cases set as above, repeated 100 times:



var isTrue = function(value) {
  switch (typeof(value)) {
    case "string":
      return !(value === '0' || value === 'false');
    case "number":
    case "boolean":
      return !!value;
    case "object":
      return Object.keys(value).length &gt; 0
  }
}

var isTrue_2 = function(value) {
  return (!!value &amp;&amp; value !== '0' &amp;&amp; value !== 'false'
    &amp;&amp; !!(typeof value !== 'object' || Object.keys(value).length));
}

var values = [false, 'false', true, 0, 1, '0', '1', 'test', {}, [], {a: 1}, [1]],
    times = 100;

console.time('isTrue');
for (var i = 0; i &lt; times; i++) {
  for (var value of values) {
    isTrue(value);
  }
}
console.timeEnd('isTrue');

console.time('isTrue_2');
for (var i = 0; i &lt; times; i++) {
  for (var value of values) {
    isTrue_2(value);
  }
}
console.timeEnd('isTrue_2');




Last point of interest: if you can have some statistics about how much the special requirements appear, you may change the order of the conditions to put the most frequent cases first, so yet improving performance.