🌐 AI搜索 & 代理 主页
Skip to content

Conversation

@hMihaiDavid
Copy link

_.template can be configured to output an async compiled template, by setting options.isAsync to true. _.template itself remains non-async.

This can be useful for users who want to use await inside the template.

Default behavior is unchanged, ie. isAsync defaults to false.

Some tests are added too. Some examples too (in the jsdoc for _.template).

EJS already supports this feature.
I made the change to use it myself for a project and figured someone else might want it too.

_.template can be configured to output an async compiled template,
by setting options.isAsync to true. _.template itself remains non-async.

This can be useful for users who want to use await inside the template.

Default behavior is unchanged, ie. isAsync defaults to false.

Some tests are added too.
@hMihaiDavid
Copy link
Author

https://www.npmjs.com/package/lodash.template-async

Just published a preview of the modularized _.template with this feature available, for anyone interested in using this already.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant