UNPKG

785 BPlain TextView Raw
1import { IHtmlEngineHelper, IHandlebarsOptions } from './html-engine-helper.interface';
2import { JsdocTagInterface } from '../../interfaces/jsdoc-tag.interface';
3
4export class JsdocParamsValidHelper implements IHtmlEngineHelper {
5 public helperFunc(context: any, jsdocTags: JsdocTagInterface[], options: IHandlebarsOptions) {
6 let i = 0;
7 let len = jsdocTags.length;
8 let tags = [];
9 let valid = false;
10
11 for (i; i < len; i++) {
12 if (jsdocTags[i].tagName) {
13 if (jsdocTags[i].tagName.text === 'param') {
14 valid = true;
15 }
16 }
17 }
18 if (valid) {
19 return options.fn(context);
20 } else {
21 return options.inverse(context);
22 }
23 }
24}