Skip to content

Commit

Permalink
fix isTrue handlebars helper
Browse files Browse the repository at this point in the history
  • Loading branch information
gregorybesson committed Sep 12, 2016
1 parent 58646b3 commit d951056
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/cli/handlebars/utils/isTrue.js
Expand Up @@ -16,15 +16,15 @@ export default function isTrue(v1, operator, v2) {
case '&&':
var eval1 = false;
var eval2 = false;
if((v1 && !Array.isArray(v1)) || (Array.isArray(v1) && v1.length>0)) eval1 = true;
if((v2 && !Array.isArray(v2)) || (Array.isArray(v2) && v1.length>0)) eval2 = true;
if((v1 && !Array.isArray(v1)) || (Array.isArray(v1) && v1.length>0) || typeof v1 === 'object') eval1 = true;
if((v2 && !Array.isArray(v2)) || (Array.isArray(v2) && v2.length>0) || typeof v2 === 'object') eval2 = true;

return (eval1 && eval2);
case '||':
var eval1 = false;
var eval2 = false;
if((v1 && !Array.isArray(v1)) || (Array.isArray(v1) && v1.length>0)) eval1 = true;
if((v2 && !Array.isArray(v2)) || (Array.isArray(v2) && v1.length>0)) eval2 = true;
if((v1 && !Array.isArray(v1)) || (Array.isArray(v1) && v1.length>0) || typeof v1 === 'object') eval1 = true;
if((v2 && !Array.isArray(v2)) || (Array.isArray(v2) && v1.length>0) || typeof v2 === 'object') eval2 = true;

return (eval1 || eval2);
default:
Expand Down

0 comments on commit d951056

Please sign in to comment.