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 isEmpty util #6

Merged
merged 5 commits into from
Oct 9, 2023
Merged

Conversation

ZIMkaRU
Copy link
Member

@ZIMkaRU ZIMkaRU commented Oct 6, 2023

This PR adds isEmpty util, it checks if value is an empty object, collection, map, or set


Note:

  • the version is not increased, we have some PRs, that can be collected into one

Copy link

@ezewer ezewer left a comment

Choose a reason for hiding this comment

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

Looks good to me!

assert.strictEqual(isEmpty({ length: '0' }), false)
})

it('should return true for negative lengths as array-like', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

should we add also tests for class instances? e.g. class Foo {}; const obj = new Foo()...

Copy link
Member Author

Choose a reason for hiding this comment

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

no need as class is syntactic sugar for prototypes
but I can add it for better readability of the tests
would you like?

Copy link
Contributor

Choose a reason for hiding this comment

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

yes please, let's include them for better long term support

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.

4 participants