UNPKG

helpers-utils

Version:

Utility methods commonly used for writing helper libraries.

23 lines (17 loc) 445 B
## expects Ensure that the expected API methods exist on an object. ```js var utils = require('helpers-utils'); var spec = { context: function() { return {}; }, registerHelpers: function() { } }; module.exports = function (config) { utils.expects(config, spec); Library.addHelper('greeting', function (userid) { var context = config.context(); var name = context[userid] || 'Guest'; return 'Hello ' + name; }); }; ```