Add array helpers, fix template errors, and tweak examples#167
Merged
alexwarren merged 13 commits intomainfrom Jan 27, 2026
Merged
Add array helpers, fix template errors, and tweak examples#167alexwarren merged 13 commits intomainfrom
alexwarren merged 13 commits intomainfrom
Conversation
When using helpers like `random` as subexpressions with the `set` helper
(e.g., `{{set "x" (random (array "a" "b"))}}`), the value was being stored
as a Handlebars SafeString object instead of a plain string, causing
`[object Object]` output and broken conditionals.
The set helper now converts objects with toString() to strings before storing.
Also updates gameshow example to use this pattern for silent random selection,
and adds a test for the subexpression scenario.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
… length) Implements feature request from issue #166. These helpers allow managing arrays stored in attributes - useful for tracking items, available options, or game state like rounds that shouldn't repeat. - append: Add element(s) to end of array - prepend: Add element(s) to start of array - pop: Remove and return first element - remove: Remove first matching value - contains: Check if array contains value - length: Get number of elements Also refactored set helper to use shared unwrapValue function, and updated the gameshow example to use these helpers for non-repeating rounds. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
When Handlebars template compilation or execution fails, errors are now displayed on screen in a styled error box with monospace font, instead of silently failing with no output. Errors are also logged to the console. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Rename "listVar" to "attribute" to match other helpers, add note explaining the parameter is an attribute name (string), not the array. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
append,prepend,pop,remove,contains,length) for the text processorsethelper to unwrap SafeString values from subexpressions{{#animate}}blocksTest plan
npm testto verify all compiler and runtime tests pass🤖 Generated with Claude Code