0.1.0 • Published 9 years ago

namespace-helpers v0.1.0

Weekly downloads
14
License
MIT
Repository
github
Last release
9 years ago

namespace-helpers NPM version

Use namespaced helpers with handlebars.

Install

Install with npm

$ npm i namespace-helpers --save

Usage

var namespace = require('namespace-helpers');
var handlebars = require('handlebars');

var obj = {
  foo: function(){},
  bar: function(){},
  baz: function(){}
};
var helpers = namespace('utils', obj);
// results in
// { 'utils.foo': [Function],
//   'utils.bar': [Function],
//   'utils.baz': [Function] }

// register with handlebars
handlebars.registerHelper(helpers);

Use in templates like this (namespaced helper names need to be quoted as string literals):

{{"utils.foo" a}}
{{"utils.bar" b}}
{{"utils.baz" c}}

Related projects

Running tests

Install dev dependencies:

$ npm i -d && npm test

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

Author

Jon Schlinkert

License

Copyright © 2015 Jon Schlinkert Released under the MIT license.


This file was generated by verb-cli on September 27, 2015.