1 | import { IHtmlEngineHelper, IHandlebarsOptions } from './html-engine-helper.interface';
|
2 |
|
3 | export class OrHelper implements IHtmlEngineHelper {
|
4 | public helperFunc(context: any /* any, any, ..., options */) {
|
5 | let len = arguments.length - 1;
|
6 | let options: IHandlebarsOptions = arguments[len];
|
7 |
|
8 | // We start at 1 because of options
|
9 | for (let i = 1; i < len; i++) {
|
10 | if (arguments[i]) {
|
11 | return options.fn(context);
|
12 | }
|
13 | }
|
14 |
|
15 | return options.inverse(context);
|
16 | }
|
17 | }
|