Skip to content

.length no longer works #457

Closed
Closed

Description

@andycnguyen

Describe the bug

Calling .length on string data in a template throws HandlebarsUndefinedBindingException (or returns an empty string).

Expected behavior:

Calling .length on string data outputs the length of that string, as it does in HandlebarsJS.

Test to reproduce

[Fact]
public void StringLength()
{
    var handlebars = Handlebars.Create();
    var render = handlebars.Compile("{{str.length}}");
    object data = new { str = "string" };
    
    var actual = render(data);
    Assert.Equal("6", actual);
}

Other related info

This feature previously worked. I discovered the current problem when attempting to upgrade from 1.11.5.0 to 2.0.8.0.

Activity

  1. added this to the v3 milestone on Dec 22, 2021
  2. added a commit that references this issue on Mar 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions