import Handlebars from "handlebars"; import I18n from "I18n"; export default function wizardCharCounter(body, maxLength) { let bodyLength = body ? body.length : 0; let finalString; if (maxLength) { let isOverMax = bodyLength > maxLength ? "true" : "false"; finalString = `
${bodyLength} / ${I18n.t( "wizard.x_characters", { count: parseInt(maxLength, 10) } )}
`; } else { finalString = `
${I18n.t("wizard.x_characters", { count: parseInt(bodyLength, 10), })}
`; } return new Handlebars.SafeString(finalString); }