(name, callback)
| 441 | |
| 442 | // Liquid, Nunjucks, and JS only |
| 443 | addAsyncFilter(name, callback) { |
| 444 | // namespacing happens downstream |
| 445 | this.#add(this.universal.filters, name, callback, { |
| 446 | description: "Universal Filter", |
| 447 | functionName: "addAsyncFilter", |
| 448 | }); |
| 449 | |
| 450 | this.addLiquidFilter(name, callback); |
| 451 | this.addJavaScriptFilter(name, callback); |
| 452 | this.addNunjucksAsyncFilter( |
| 453 | name, |
| 454 | /** @this {any} */ |
| 455 | async function (...args) { |
| 456 | let cb = args.pop(); |
| 457 | // Note that `callback` is already a function as the `#add` method throws an error if not. |
| 458 | let ret = await callback.call(this, ...args); |
| 459 | cb(null, ret); |
| 460 | }, |
| 461 | ); |
| 462 | } |
| 463 | |
| 464 | /* |
| 465 | * Shortcodes |
no test coverage detected