UNPKG

helper-compile-async

Version:

Convenience method to compile async helpers and add common functionality to use with async-helpers.

80 lines (49 loc) 2.58 kB
# helper-compile-async [![NPM version](https://img.shields.io/npm/v/helper-compile-async.svg?style=flat)](https://www.npmjs.com/package/helper-compile-async) [![NPM monthly downloads](https://img.shields.io/npm/dm/helper-compile-async.svg?style=flat)](https://npmjs.org/package/helper-compile-async) [![NPM total downloads](https://img.shields.io/npm/dt/helper-compile-async.svg?style=flat)](https://npmjs.org/package/helper-compile-async) [![Linux Build Status](https://img.shields.io/travis/helpers/helper-compile-async.svg?style=flat&label=Travis)](https://travis-ci.org/helpers/helper-compile-async) > Convenience method to compile async helpers and add common functionality to use with async-helpers. ## Install Install with [npm](https://www.npmjs.com/): ```sh $ npm install --save helper-compile-async ``` ## Usage ```js var compile = require('helper-compile-async'); ``` ## API ### [compile](index.js#L23) Compile a helper function to add convenience methods for working with [async-helpers](https://github.com/doowb/async-helpers). **Params** * `helper` **{Function}**: Helper function to be called with a modified `options.fn` and `options.inverse` function if available. * `returns` **{Function}**: Compiled helper function suitable to be registered with a template engine. **Example** ```js // ensures that asyncHelpers.resolveIds is called on the // rendered content from `options.fn` before returning var helper = compile(function(options, cb) { return options.fn(this, cb); }); ``` ## About ### Contributing Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). Please read the [contributing guide](contributing.md) for advice on opening issues, pull requests, and coding standards. ### Building docs _(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_ To generate the readme, run the following command: ```sh $ npm install -g verbose/verb#dev verb-generate-readme && verb ``` ### Running tests Install dev dependencies: ```sh $ npm install && npm test ``` ### Author **Brian Woodward** * [github/doowb](https://github.com/doowb) * [twitter/doowb](https://twitter.com/doowb) ### License Copyright © 2017, [Brian Woodward](https://github.com/doowb). MIT *** _This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.4.2, on February 05, 2017._