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

just-is-empty function fails to detect symbol properties in objects #554

Closed
palashmon opened this issue Apr 28, 2023 · 0 comments
Closed

Comments

@palashmon
Copy link
Contributor

Package name:

  • just-is-empty

URL:

Issue Description:

  • The isEmpty() function, as currently implemented, fails to correctly detect when an object has properties with symbols as keys. This can result in incorrect output when using the function to check if an object is empty.

Steps to reproduce:

  1. Create an object with a symbol property:
    const isEmpty = require('just-is-empty');
    
    const mySymbol = Symbol('mySymbol');
    const myObject = {
      [mySymbol]: 7
    };
  2. Call the isEmpty() function with myObject as the argument:
    console.log(myObject);	// {[Symbol("mySymbol")]: 7}
    isEmpty(myObject);		// true

Expected output: false
Actual output: true

ginoemiliozzi added a commit to ginoemiliozzi/just that referenced this issue May 1, 2023
@angus-c angus-c closed this as completed in 06e0e7d May 6, 2023
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

No branches or pull requests

1 participant