Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hbs-async-helpers

Package Overview
Dependencies
Maintainers
0
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hbs-async-helpers

Adds support for async functions to handlebars

  • 1.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
154
increased by63.83%
Maintainers
0
Weekly downloads
 
Created
Source

HBS Async Helpers

Library that adds support for asynchronous function helpers to the handlebars template engine.

How to install

npm i hbs-async-helpers

How to import

CommonJS

const Handlebars = require("handlebars");
const asyncHelpers = require("hbs-async-helpers");

ES6

import Handlebars from 'handlebars',
import asyncHelpers from 'hbs-async-helpers';

Usage

const hb = asyncHelpers(handlebars);

hb.registerHelper(
  "sleep",
  async () =>
    new Promise((resolve) => {
      setTimeout(() => resolve("Done!"), 1000);
    })
);

const template = hb.compile("Mark when is completed: {{#sleep}}{{/sleep}}");
const result = await template();

console.log(result);
// 'Mark when is completed: Done!'

Acknowlegments

This package has been forked from handlebars-async-helpers originally created and maintained by Gaston Robledo.

Keywords

FAQs

Package last updated on 21 Sep 2024

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc