UNPKG

twing

Version:

First-class Twig engine for Node.js

29 lines (28 loc) 1.28 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.createSynchronousTest = exports.createTest = void 0; const callable_wrapper_1 = require("./callable-wrapper"); /** * Creates a template test. * * @param {string} name Name of the test * @param {TwingCallable<boolean>} callable A callable implementing the test. If null, you need to overwrite the "node_class" option to customize compilation. * @param {TwingCallableArgument[]} acceptedArguments * @param {TwingCallableWrapperOptions} options Options */ const createTest = (name, callable, acceptedArguments, options = {}) => { return (0, callable_wrapper_1.createCallableWrapper)(name, callable, acceptedArguments, options); }; exports.createTest = createTest; /** * Creates a synchronous template test. * * @param name Name of the test * @param callable A callable implementing the test. If null, you need to overwrite the "node_class" option to customize compilation. * @param acceptedArguments * @param options Options */ const createSynchronousTest = (name, callable, acceptedArguments, options = {}) => { return (0, callable_wrapper_1.createSynchronousCallableWrapper)(name, callable, acceptedArguments, options); }; exports.createSynchronousTest = createSynchronousTest;