
Security News
How Enterprise Security Is Adapting to AI-Accelerated Threats
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.
async-helpers
Advanced tools
Use async helpers in template engines like Handlebars and Lodash.
npm i async-helpers --save
var helperAsync = require('async-helpers');
Create a new instance of AsyncHelpers
returns {Object}: new AsyncHelpers instancevar asyncHelpers = new AsyncHelpers();
Add a helper to the cache.
name {String}: Name of the helperfn {Function}: Helper functionreturns {Object}: Returns this for chainingasyncHelpers.set('upper', function (str, done) {
done(null, str.toUpperCase());
});
Get all helpers or a helper with the given name.
name {String}: Optionally pass in a name of a helper to get.options {Object}: Additional options to use.returns {Function|Object}: Single helper function when name is provided, otherwise object of all helpersvar helpers = asyncHelpers.get();
var wrappedHelpers = helperAync.get({wrap: true});
Wrap a helper with async handling capibilities.
name {String}: Optionally pass the name of the helper to wrapreturns {Function|Object}: Single wrapped helper function when name is provided, otherwise object of all wrapped helpers.var wrappedHelper = asyncHelpers.wrap('upper');
var wrappedHelpers = asyncHelpers.wrap();
Reset all the stashed helpers.
returns {Object}: Returns this to enable chainingasyncHelpers.reset();
Resolve a stashed helper by the generated id.
key {String}: ID generated when from executing a wrapped helper.done {Function}: Callback function with the results of executing the async helper.var upper = asyncHelpers.get('upper', {wrap: true});
var id = upper('doowb');
asyncHelpers.resolve(id, function (err, result) {
console.log(result);
//=> DOOWB
});
Install dev dependencies:
npm i -d && npm test
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue
Brian Woodward
Copyright (c) 2015 Brian Woodward
Released under the MIT license
This file was generated by verb-cli on March 18, 2015.
FAQs
Use async helpers in templates with engines that typically only handle sync helpers. Handlebars and Lodash have been tested.
The npm package async-helpers receives a total of 22,550 weekly downloads. As such, async-helpers popularity was classified as popular.
We found that async-helpers demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.