helper-cache
Easily get and set helper functions to pass to any application or template engine.
Install
Install with npm:
npm i helper-cache --save-dev
Usage
var Cache = require('helper-cache');
var helpers = new Cache();
helpers.set('a', function (str) {
return str.toLowerCase();
});
helpers.set('b', function (str) {
return str.toUpperCase();
});
console.log(helpers)
var mixins = new Cache();
mixins.set('a', function (str) {
return str.toLowerCase();
});
mixins.set('b', function (str) {
return str.toUpperCase();
});
console.log(mixins);
API
options
{Object}: Default options to use.
bindFunctions
{Boolean}: Bind functions to this
. Defaults to false
.
var Helpers = require('helper-cache');
var helpers = new Helpers();
Set helpers on the cache.
See load-helpers for issues, API details and the full range of options.
key
{String}: The helper to get.returns
{Object}: The specified helper. If no key
is passed, the entire cache is returned.
Get a helper from the cache.
Author
Jon Schlinkert
Brian Woodward
License
Copyright (c) 2014 Jon Schlinkert, contributors.
Released under the MIT license
This file was generated by verb-cli on August 29, 2014.