Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow logical comparisons in handlebars #77

Closed
wants to merge 3 commits into from

Conversation

ImperialSquid
Copy link
Contributor

Fixes: #56, #64

Adds the compare helper and various useful comparisons

Example use case:

---
topics:
  label: How many topic headers to use?
  type: num

---

{{#compare topics ">=" 1}}
# Header 1

{{#compare topics ">=" 2}}
# Header 2

{{#compare topics ">=" 3}}
# Header 3

{{/compare}}
{{/compare}}
{{/compare}}

Not included, but is a good idea:

  • This should be mentioned in the README somewhere
  • Needs tests added (I had a quick look but I'm not familiar with testing in JS/TS)

@ImperialSquid ImperialSquid linked an issue Jul 2, 2023 that may be closed by this pull request
@ImperialSquid
Copy link
Contributor Author

@nishantwrp

@nishantwrp
Copy link
Collaborator

Thank you so much for this pull request @ImperialSquid. I have decided to take this one step further and allow users to do even more with templates. This pull request motivated me to do this. I've created another pull request for that and included your commits in that pr (so, closing this one).

Pull Request: #79

@nishantwrp nishantwrp closed this Oct 28, 2023
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.

Feature Request: Add Logic to Handlebars Add (string) comparison as helper function
2 participants