feat(handlebars plugin): adding handlebars helpers for common math operations (#20648)

* feat(plugin-chart-handlebars): add common helpers

* add import

* add declare module

Co-authored-by: Ville Brofeldt <ville.v.brofeldt@gmail.com>
This commit is contained in:
Evan Rusackas
2022-07-08 07:10:29 -07:00
committed by GitHub
parent 4e6e87f62e
commit 9856d88c03
4 changed files with 55 additions and 4 deletions

View File

@@ -21,6 +21,7 @@ import Handlebars from 'handlebars';
import moment from 'moment';
import React, { useMemo, useState } from 'react';
import { isPlainObject } from 'lodash';
import Helpers from 'just-handlebars-helpers';
export interface HandlebarsViewerProps {
templateSource: string;
@@ -73,3 +74,5 @@ Handlebars.registerHelper('stringify', (obj: any, obj2: any) => {
throw Error('Please call with an object. Example: `stringify myObj`');
return isPlainObject(obj) ? JSON.stringify(obj) : String(obj);
});
Helpers.registerHelpers(Handlebars);