UNPKG

drupal-twig-extensions

Version:

JavaScript implementation of Drupal’s Twig extensions

23 lines (22 loc) 763 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"); async function callable(element, argsMap) { // Twing will give an is_variadic filter its arguments as a Map. const args = Array.from(argsMap.values()).map(value => { if (value instanceof Map) { // Twing v5 converts Twig [] into JS Maps; convert to an Array. return Array.from(value.values()); } else { return value; } }); return (0, _definition.without)(element, ...args); } var _default = (0, _twing.newTwingFilter)(_definition.name, callable, _definition.options); exports.default = _default;