Skip to content

Bracket in identifier name causing panic in #if helper #1

@flowchartsman

Description

@flowchartsman

As mentioned in aymerick/raymond#34, the following will panic:

{{#if wat[0].fnord}}wat{{/if}}

But so will this:

{{#if wat[0]}}wat{{/if}}

I believe the original issue is something of a red herring, since you're not supposed to access array elements like this in handlebars. The correct notation would be:

{{#if wat.[0]}}wat{{/if}}

Which does NOT panic if wat does not exist.

So the question isn't so much why a missing reference is panicking, it's why the bracket is being allowed (or not) when it should be (or not), thus causing a panic.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions