nknapp / promised-handlebars

Wrapper for Handlebars that allows helpers returning promises
MIT License
47 stars 15 forks source link

preserve original synchronous compile function as compileSync #33

Closed Gottwik closed 7 years ago

Gottwik commented 7 years ago

I have tens of tests for handlebars helpers and having compileSync function makes it easier to test them. Other than that it just seems like a nice idea to preserve the original synchronous function.

coveralls commented 7 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling b19dc6dbbcaf8722ad3c0bfee6e04affbe9d1c7b on Gottwik:master into b53ec5848a7cec29158d8682ea2e35eeabc22d1b on nknapp:master.

coveralls commented 7 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling b19dc6dbbcaf8722ad3c0bfee6e04affbe9d1c7b on Gottwik:master into b53ec5848a7cec29158d8682ea2e35eeabc22d1b on nknapp:master.

nknapp commented 7 years ago

Are those helpers synchronous or asynchronous? I am still wondering about the exact use case.

If your helpers are synchronous, why not just use Handlebars directly? If your helpers are asynchronous, a compileSync-function probably won't help you a lot, because it will just return the placeholder for the promise result. It does not feel like the method makes much sense, but maybe I have missed something.

And since I just thought if it's worth to discuss this for a single line of code: There is a little more work to be done. The final PR should include:

nknapp commented 7 years ago

@Gottwik I'm closing this PR for now. If you are still interested, please add a comment.