@umpacken/handlebars-async-helpers

1.1.1 • Public • Published

IMPORTANT: This is the repack of the original version with updated dependencies

Handlebars Async Helpers

Library that adds support to asynchronous function helpers to handlebars lib.

How to install

npm install handlebars-async-helpers

How to use

const handlebars = require('handlebars'),
      asyncHelpers = require('handlebars-async-helpers')

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!'

Readme

Keywords

none

Package Sidebar

Install

npm i @umpacken/handlebars-async-helpers

Weekly Downloads

28

Version

1.1.1

License

MIT

Unpacked Size

30.3 kB

Total Files

11

Last publish

Collaborators

  • nordluf