makeHelpers

  • typedef
documentjs.generators.html.types.makeHelpers

{function(docMap, options, getCurrent, helpers)}

 

function(docMap, options, getCurrent, helpers)

Parameters

  1. docMap {docMap}

    Contains every docObject keyed by its name.

  2. options {Object}

    The options passed to generate.

  3. getCurrent {function()}

    Returns the current docObject being rendered.

  4. helpers {generators.html}

    The default helpers object that the return value will be added to.

Returns

{Object<String,function()>}

A map of Handlebars function helpers that will be registered.

Use

To create a helper that loops through every function's name excluding the current page's name:

module.exports = function(docMap,options,getCurrent, defaultHelpers, Handlebars){
  return {
    eachFunction: function(options){
      for(var name in docMap) {
        var docObject = docMap[name];
        if(docObject.type === "function" && name !== getCurrent().name) {
          return options.fn(name);
        }
      }
    }
  };
};