count(): simply return total number of items if no function supplied. #15

Open
wants to merge 2 commits into
from

Conversation

Projects
None yet
2 participants
@timoxley
Member

timoxley commented Dec 16, 2012

As far as I can tell, there's no way to access the length of the enumerable's data via the enumerable interface without invoking __iterator__.length, or doing .count(function(){return true}). This grants access to the length via calling count() without a function argument, e.g.

var arr = Enumerable([1,2,3,4,5]);
arr.count().should.equal(5);
@timoxley

This comment has been minimized.

Show comment
Hide comment
@timoxley

timoxley Dec 17, 2012

Member

Possible should also add a length() method or something.

Member

timoxley commented Dec 17, 2012

Possible should also add a length() method or something.

@tj

This comment has been minimized.

Show comment
Hide comment
@tj

tj Dec 17, 2012

Member

+1 for .length()

Member

tj commented Dec 17, 2012

+1 for .length()

@tj

This comment has been minimized.

Show comment
Hide comment
@tj

tj Dec 17, 2012

Member

this needs a rebase apparently

Member

tj commented Dec 17, 2012

this needs a rebase apparently

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