• Similar to template, but will render an iterable (such as array) of items together instead of rendering each item individually. It improves efficiency in these scenarios because only 1 rendering function is called.

    Parameters

    • templateStr: string

      The template string

    • argNames: string[] = ...

      The names of the parameters (starting with the iterable) of the returned function (which can be 'seen' inside the template string). Defauts to ['iter']

    • itemName: string = 'item'

      The name of the current item of the iterable as seen inside the template string. Defaults to 'item'

    Returns ITemplates

    Example

    import { templates } from 'deleight/template';
    const t = templates('I will render this ${it}/${other} immediately!!!', ['iter', 'other'], 'it')([1, 2, 3, 4, 5], '(shared)').join(' & ');
    // t === 'I will render this 1/(shared) immediately!!! & I will render this 2/(shared) immediately!!! & I will render this 3/(shared) immediately!!! & I will render this 4/(shared) immediately!!! & I will render this 5/(shared) immediately!!!'