can-stache
Version:
Live binding handlebars templates
29 lines (18 loc) • 730 B
Markdown
else}} FALSY {{/ or }}`
`or( x, y )` works just like `x || y`. You can use it directly within a magic tag like:
```js
import {stache} from "can";
var view = stache(`{{# or(this.x, this.y) }} YES {{else}} NO {{/ or }}`);
var fragment = view({ x: 0, y: true});
console.log(fragment.firstChild.nodeValue) //-> YES
document.body.append(fragment);
```
You can use `or` in a nested expression like:
```html
{{# if( or(this.x, this.y) ) }} YES {{else}} NO {{/ or }}
```
It also takes multiple arguments. `or( x, y, z )` works just like `x || y || z`.
can-stache.helpers.or or
can-stache.htags
Perform a logical OR (||).
`{{# or([EXPRESSION...]) }} TRUTHY {{