linkedin / linkedin/dustjs

Add functions that work with Promises

Open
#767 2 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
2.9k
Forks
461
PR merge metrics
No merged PRs in 30d

Description

In may scenarios things are simplified with Promises. It'd be handy to have some built into Dust e.g. (for illustration)

```javascript
Object.assign(dust, {
asyncRenderSource(str='', view={}) {
return new Promise((res, rej) => {
const template = dust.loadSource(dust.compile(str, ''))
try {
dust.render(template, view, (err, out) => err ? rej(err) : res(out))
} catch(e) { rej(e) } // see #107
})
}
})
```
Noting #107 re. syntax errors.

Cheers . :beers:

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no files or tests; start by reading Dust's compile, loadSource, and render entry points, then review the syntax-error context in #107. Done means the agreed Promise-based Dust functions are defined and covered by tests for successful rendering and error handling, though the issue does not specify the full API scope.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
web-dev
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.