UNPKG

@christianwiedemann/drupal-twig-extensions

Version:

JavaScript implementation of Drupal’s Twig extensions

24 lines (23 loc) 837 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.callable = callable; exports.default = void 0; var _twing = require("../../helpers/twing.cjs"); var _definition = require("./definition.cjs"); function surround(value, attributeName, attributeValue) { return `<div ${attributeName}="${attributeValue}">${value}</div>`; } function callable(value, attributeName, attributeValue) { if (typeof value === 'object') { const output = []; Object.values(value).forEach(value => { output.push(surround(value, attributeName, attributeValue)); }); return output.join(' '); } return surround(value, attributeName, attributeValue); } var _default = (0, _twing.newTwingFilter)(_definition.name, callable, _definition.options, _definition.acceptedArguments); exports.default = _default;