Permalink
Browse files

Add type to comparison helpers to compare with booleans

  • Loading branch information...
Pikkulahti committed May 8, 2018
1 parent fc597c8 commit c4625e34d368655404e97d18134a9ee745dfa145
Showing with 9 additions and 0 deletions.
  1. +9 −0 dust/Helper/Comparison.php
@@ -29,6 +29,15 @@ public function __invoke(Evaluate\Chunk $chunk, Evaluate\Context $context, Evalu
$chunk->setError('Must be in select or have key parameter');
}
if ( isset( $params->type ) ) {
$type = $params->type;
if ( $type === 'boolean' ) {
// Convert value to boolean.
$value = filter_var( $value, FILTER_VALIDATE_BOOLEAN );
}
}
if ( $bodies->block === null ) {
$bodies->block = new \Dust\Ast\Body(0);
}

0 comments on commit c4625e3

Please sign in to comment.