extend helper

Usage no npm install needed!

<script type="module">
  import dustmotesExtend from 'https://cdn.skypack.dev/dustmotes-extend';


extend helper, Define ad hoc custom helper or filter


{@extend helper=string|filter=string /}code{/extend}

helper - name of the helper

filter - name of the filter


{@extend helper="assist"}
function assist (chk, ctx, bodies, params) {
        var key = dust.helpers.tap(params.key, chk, ctx);
        return chk.write(key + key);

{@assist key="go"/}

{@extend filter="my"}
function myfilter(string) {return "***" + string + "***"; };

FILTERED: {str | my}


Depends on dustjs-helpers module to be loaded first since it defines the dust.helpers property.

In node.js: require('dustmotes-iterate');

In browser: If not using require, load the JS some other way and call it with the dust object. As noted earlier, dustjs-helpers must be loaded earlier.