Skip to content

Latest commit

 

History

History
110 lines (65 loc) · 1.98 KB

.verb.md

File metadata and controls

110 lines (65 loc) · 1.98 KB

Usage

To get all helpers:

const helpers = require('{%= name %}')();
console.log(helpers);

Get a specific helper category

// get only the math helpers
const helpers = require('{%= name %}')('math');

Get multiple helper categories

// get only the math helpers
const helpers = require('{%= name %}')(['math', 'string']);

Template-engine agnostic

Lo-Dash Example

const helpers = require('{%= name %}')('array');

// pass helpers on `imports`
const imports = { imports: helpers };

// compile a template
const fn = _.template('<%= first(foo) %>', imports);

// render
fn({ foo: ['a', 'b', 'c'] });
//=> 'a'

Namespacing

Handlebars and Lo-Dash both allow dot notation to be used for referencing helpers. I'd be happy to add examples for other engines if someone wants to do a PR.

Example

<%= path.dirname("a/b/c/d.js") %>

This can be used as a way of working around potential naming conflicts.

Helpers

(The following API Table of Contents is generated by [verb][]. See the verbfile.js for more details.)

{%= include("docs/toc.md") %}

array

{%= increaseHeadings(apidocs("lib/helpers/array.js")) %}

code

{%= increaseHeadings(apidocs("lib/helpers/code.js")) %}

collection

{%= increaseHeadings(apidocs("lib/helpers/collection.js")) %}

conditional

{%= increaseHeadings(apidocs("lib/helpers/conditional.js")) %}

fs

{%= increaseHeadings(apidocs("lib/helpers/fs.js")) %}

html

{%= increaseHeadings(apidocs("lib/helpers/html.js")) %}

index

{%= increaseHeadings(apidocs("lib/helpers/index.js")) %}

math

{%= increaseHeadings(apidocs("lib/helpers/math.js")) %}

object

{%= increaseHeadings(apidocs("lib/helpers/object.js")) %}

path

{%= increaseHeadings(apidocs("lib/helpers/path.js")) %}

string

{%= increaseHeadings(apidocs("lib/helpers/string.js")) %}

Coverage

{%= coverage("coverage/summary.txt") %}