
Security News
ESLint Adds Official Support for Linting HTML
ESLint now supports HTML linting with 48 new rules, expanding its language plugin system to cover more of the modern web development stack.
base-helpers
Advanced tools
Adds support for managing template helpers to your base application.
Adds support for managing template helpers to your base application.
Install with npm:
$ npm install --save base-helpers
Install with yarn:
$ yarn add base-helpers
Register the plugin with your base application:
var Base = require('base');
var helpers = require('base-helpers');
base.use(helpers());
Register a template helper.
Params
name
{String}: Helper namefn
{Function}: Helper function.Example
app.helper('upper', function(str) {
return str.toUpperCase();
});
Register multiple template helpers.
Params
helpers
{Object|Array}: Object, array of objects, or glob patterns.Example
app.helpers({
foo: function() {},
bar: function() {},
baz: function() {}
});
Register an async helper.
Params
name
{String}: Helper name.fn
{Function}: Helper functionExample
app.asyncHelper('upper', function(str, next) {
next(null, str.toUpperCase());
});
Register multiple async template helpers.
Params
helpers
{Object|Array}: Object, array of objects, or glob patterns.Example
app.asyncHelpers({
foo: function() {},
bar: function() {},
baz: function() {}
});
Get a previously registered helper.
Params
name
{String}: Helper namereturns
{Function}: Returns the registered helper function.Example
var fn = app.getHelper('foo');
Get a previously registered async helper.
Params
name
{String}: Helper namereturns
{Function}: Returns the registered helper function.Example
var fn = app.getAsyncHelper('foo');
Return true if sync helper name
is registered.
Params
name
{String}: sync helper namereturns
{Boolean}: Returns true if the sync helper is registeredExample
if (app.hasHelper('foo')) {
// do stuff
}
Return true if async helper name
is registered.
Params
name
{String}: Async helper namereturns
{Boolean}: Returns true if the async helper is registeredExample
if (app.hasAsyncHelper('foo')) {
// do stuff
}
Register a namespaced helper group.
Params
helpers
{Object|Array}: Object, array of objects, or glob patterns.Example
// markdown-utils
app.helperGroup('mdu', {
foo: function() {},
bar: function() {},
});
// Usage:
// <%= mdu.foo() %>
// <%= mdu.bar() %>
log
helper can be a function, but it can also have log.warning
and log.info
functions as properties.option
, enable
and disable
. See the readme… more | homepagePull requests and stars are always welcome. For bugs and feature requests, please create an issue.
(This project's readme.md is generated by verb, please don't edit the readme directly. Any changes to the readme must be made in the .verb.md readme template.)
To generate the readme, run the following command:
$ npm install -g verbose/verb#dev verb-generate-readme && verb
Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
$ npm install && npm test
Jon Schlinkert
Copyright © 2017, Jon Schlinkert. Released under the MIT License.
This file was generated by verb-generate-readme, v0.5.0, on April 20, 2017.
FAQs
Adds support for managing template helpers to your base application.
The npm package base-helpers receives a total of 20,649 weekly downloads. As such, base-helpers popularity was classified as popular.
We found that base-helpers demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
ESLint now supports HTML linting with 48 new rules, expanding its language plugin system to cover more of the modern web development stack.
Security News
CISA is discontinuing official RSS support for KEV and cybersecurity alerts, shifting updates to email and social media, disrupting automation workflows.
Security News
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.