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

toBeEmpty Map and Set #158

Closed
mattphillips opened this issue Aug 14, 2018 · 3 comments
Closed

toBeEmpty Map and Set #158

mattphillips opened this issue Aug 14, 2018 · 3 comments

Comments

@mattphillips
Copy link
Member

Add support to toBeEmpty for Map and Set data structures

@moredip
Copy link
Contributor

moredip commented Aug 14, 2018

How would you feel about implementing this by modifying the toBeEmpty predicate to match on either {} or an empty Iterable? That would, I believe, provide the existing verification on empty object, Array, or String, plus all the other built-in iterables like Map and Set, plus user-defined iterables.

@mattphillips
Copy link
Member Author

Hey @moredip that sounds like a sensible approach! I like that it will also apply to custom iterables 😄

I think we might be able to leverage the spread operator to condense the logic to something like:

[...iterable].length === 0

Fancy sending a PR for this?

@mattphillips
Copy link
Member Author

Merged 🎉

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

2 participants