UNPKG

414 BPlain TextView Raw
1import { IHtmlEngineHelper, IHandlebarsOptions } from './html-engine-helper.interface';
2
3export class HasOwnHelper implements IHtmlEngineHelper {
4 public helperFunc(context: any, entity, key: any, options: IHandlebarsOptions): string {
5 if (Object.hasOwnProperty.call(entity, key)) {
6 return options.fn(context);
7 } else {
8 return options.inverse(context);
9 }
10 }
11}