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

fix deepkeys to work with empty arrays and objects #105

Merged
merged 1 commit into from
Apr 22, 2023

Conversation

AuthorProxy
Copy link
Contributor

@AuthorProxy AuthorProxy commented Mar 3, 2023

fix #104

@AuthorProxy AuthorProxy force-pushed the fix_deepkeys_fn branch 3 times, most recently from 40f947c to 9045742 Compare March 3, 2023 17:58
index.js Outdated Show resolved Hide resolved
@sindresorhus
Copy link
Owner

CI is failing

Copy link
Contributor

@mmkal mmkal left a comment

Choose a reason for hiding this comment

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

IMO: this behaviour is a little more intuitive than skipping empty objects. It'd be great to have something explicit in the docs though.

@AuthorProxy AuthorProxy force-pushed the fix_deepkeys_fn branch 2 times, most recently from 8f27bed to 4ca581e Compare March 8, 2023 09:05
@AuthorProxy
Copy link
Contributor Author

sorry, I was a little busy with other projects, now I fixed as it should be, all tests passed @sindresorhus

@sindresorhus
Copy link
Owner

You need to update the docs.

@AuthorProxy
Copy link
Contributor Author

AuthorProxy commented Apr 18, 2023

You need to update the docs.

@sindresorhus check it

@AuthorProxy AuthorProxy force-pushed the fix_deepkeys_fn branch 2 times, most recently from b6c642b to 8aee18b Compare April 19, 2023 00:02
readme.md Outdated
@@ -110,7 +110,7 @@ console.log(getProperty(object, escapedPath));

### deepKeys(object)

Returns an array of every path. Plain objects are deeply recursed and are not themselves included.
Returns an array of every path. Plain not empty objects are deeply recursed and are not themselves included. Empty objects or objects without values are included, e.g [], {}, null, undefined or NaN.
Copy link
Owner

Choose a reason for hiding this comment

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

This is more confusing than it needs to be. Just say that non-empty plain objects and arrays are not themselves included.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@sindresorhus check it

@sindresorhus
Copy link
Owner

You also need to update index.d.ts docs.

@sindresorhus sindresorhus merged commit 49e9082 into sindresorhus:main Apr 22, 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

Successfully merging this pull request may close these issues.

deepKeys returns strange result
3 participants