Skip to content

Implement visit.count() #9

@lahmatiy

Description

@lahmatiy

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions