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

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

Open
flyingL123 opened this issue Jul 1, 2016 · 0 comments
Open

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

flyingL123 opened this issue Jul 1, 2016 · 0 comments

Comments

@flyingL123
Copy link

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.

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

No branches or pull requests

1 participant