Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
async-helpers
Advanced tools
Use async helpers in templates with engines that typically only handle sync helpers. Handlebars and Lodash have been tested.
Use async helpers in templates with engines that typically only handle sync helpers. Handlebars and Lodash have been tested.
Please consider following this project's author, Brian Woodward, and consider starring the project to show your :heart: and support.
Install with npm:
$ npm install --save async-helpers
var asyncHelpers = require('async-helpers');
Create a new instance of AsyncHelpers
Params
options
{Object}: options to pass to instancereturns
{Object}: new AsyncHelpers instanceExample
var asyncHelpers = new AsyncHelpers();
Add a helper to the cache.
Params
name
{String}: Name of the helperfn
{Function}: Helper functionreturns
{Object}: Returns this
for chainingExample
asyncHelpers.set('upper', function(str, cb) {
cb(null, str.toUpperCase());
});
Get all helpers or a helper with the given name.
Params
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 helpersExample
var helpers = asyncHelpers.get();
var wrappedHelpers = asyncHelpers.get({wrap: true});
Wrap a helper with async handling capibilities.
Params
helper
{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.Example
var wrappedHelper = asyncHelpers.wrap('upper');
var wrappedHelpers = asyncHelpers.wrap();
Reset all the stashed helpers.
returns
{Object}: Returns this
to enable chainingExample
asyncHelpers.reset();
Resolve a stashed helper by the generated id. This is a generator function and should be used with co
Params
key
{String}: ID generated when from executing a wrapped helper.Example
var upper = asyncHelpers.get('upper', {wrap: true});
var id = upper('doowb');
co(asyncHelpers.resolveId(id))
.then(console.log)
.catch(console.error);
//=> DOOWB
After rendering a string using wrapped async helpers, use resolveIds
to invoke the original async helpers and replace the async ids with results from the async helpers.
Params
str
{String}: String containing async idscb
{Function}: Callback function accepting an err
and content
parameters.Example
asyncHelpers.resolveIds(renderedString, function(err, content) {
if (err) return console.error(err);
console.log(content);
});
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
$ npm install && npm test
(This project's readme.md is generated by verb, please don't edit the readme directly. Any changes to the readme must be made in the .verb.md readme template.)
To generate the readme, run the following command:
$ npm install -g verbose/verb#dev verb-generate-readme && verb
You might also be interested in these projects:
Commits | Contributor |
---|---|
85 | doowb |
34 | jonschlinkert |
1 | nknapp |
Brian Woodward
Copyright © 2017, Brian Woodward. Released under the MIT License.
This file was generated by verb-generate-readme, v0.6.0, on November 05, 2017.
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 23,466 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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.