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

Implement visit.count() #9

Open
lahmatiy opened this issue Jul 16, 2016 · 0 comments
Open

Implement visit.count() #9

lahmatiy opened this issue Jul 16, 2016 · 0 comments

Comments

@lahmatiy
Copy link
Member

lahmatiy commented Jul 16, 2016

Now we can do

assert(visit.list().length === 2);

Would be better implement method for this case.

assert(visit.count() === 2);

And alternative for list().filter(..)

assert(visit.list().filter(x => x === 'foo').length > 0);
// ->
assert(visit.count(x => x === 'foo') > 0);
assert(visit.count('foo') > 0);
assert(visit.count({ foo: 1}) === 0);

When non-function passed to visit.count() internal compareValues() for non-strict comparison should be used.

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

No branches or pull requests

1 participant