UNPKG

@crowdin/app-project-module

Version:

Module that generates for you all common endpoints for serving standalone Crowdin App

47 lines (46 loc) 1.6 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.engine = void 0; const express_handlebars_1 = __importDefault(require("express-handlebars")); exports.engine = (0, express_handlebars_1.default)({ layoutsDir: '', defaultLayout: '', helpers: { ifeq: function (a, b, options) { if (a === b) { return options.fn(this); } return options.inverse(this); }, checkLength: function (a, b, options) { if (a.length > b) { return options.fn(this); } return options.inverse(this); }, in: function (a, b, options) { if (a !== undefined && a !== null && b !== undefined && b !== null) { let bArray; if (Array.isArray(b)) { bArray = b.map((item) => item.toString()); } else { bArray = b.toString().split(' '); } if (bArray.includes(a === null || a === void 0 ? void 0 : a.toString())) { return options.fn(this); } } return options.inverse(this); }, or: function (a, b, options) { return a || b ? options.fn(this) : options.inverse(this); }, incrementedIndex: function (index) { return index + 1; }, }, });