UNPKG

helpers-utils

Version:

Utility methods commonly used for writing helper libraries.

71 lines (46 loc) 1.83 kB
# helpers-utils [![NPM version](https://badge.fury.io/js/helpers-utils.png)](http://badge.fury.io/js/helpers-utils) > Utility methods commonly used for writing helper libraries. ## Getting Started To install the module, run the following in the command line: ```bash npm i helpers-utils --save ``` Use within your application with the following line of JavaScript: ```js var utils = require('helpers-utils'); ``` ## Usage ### 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; }); }; ``` ## Contributing Find a bug? Have a feature request? Please [create an Issue](https://github.com/helpers/helpers-utils/issues). In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality, and run `docs` in the command line to build the docs with [Verb](https://github.com/assemble/verb). Pull requests are also encouraged, and if you find this project useful please consider "starring" it to show your support! Thanks! ## Author **Jon Schlinkert** + [github/jonschlinkert](https://github.com/jonschlinkert) + [twitter/jonschlinkert](http://twitter.com/jonschlinkert) **Brian Woodward** + [github/doowb](https://github.com/doowb) + [twitter/doowb](http://twitter.com/jonschlinkert) ## License Copyright (c) 2014 Brian Woodward, contributors. Released under the MIT license *** _This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on March 23, 2014._