Skip to content

'for' helper should still work if from == to #90

Description

@flyingL123

On line 33 of the for helper:

if (to <= from) {
  return;
}

This should instead be:

if (to < from) {
  return;
}

If the values are equal, the helper should still run for a single iteration. For example, if I wanted to print options in a select list from 1 up to a product's stock_level, I would write:

<select>
  {{#for 1 product.stock_level}}
    <option value="{{$index}}">{{$index}}</option>
  {{/for}}
</select>

If the product's stock level is 1, the for helper doesn't run, and no options are returned, which is not the desired outcome.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions