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

Add @first and @last data variables to #each helper #615

Closed

Conversation

denniskuczynski
Copy link
Contributor

This is a pull request for adding @FIRST and @last data variables to the #each helper. The implementation is as described in issue #483 along with basic tests .

@FIRST returns true during the first element of the array, otherwise false.
@last returns true during the last element of the array, otherwise false.

Let me know if you have any feedback,
Thanks,
Dennis

if (data) {
data.index = i;
data.first = (i === 0) ? true : false;
data.last = (i === (context.length-1)) ? true : false;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to use the ? operator if creating a boolean result.

@denniskuczynski
Copy link
Contributor Author

Thanks @kpdecker, I've removed the excess ? operator calls.

kpdecker added a commit that referenced this pull request Oct 12, 2013
@kpdecker
Copy link
Collaborator

There were a lot of changes on master so I rebased this locally, but that appears to have confused github. Merged.

@kpdecker kpdecker closed this Oct 12, 2013
@kpdecker
Copy link
Collaborator

Thanks!

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

Successfully merging this pull request may close these issues.

2 participants