-
Notifications
You must be signed in to change notification settings - Fork 1
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
Does not handle empty string correctly #30
Comments
Ohhh interesting edge case, because We may need to talk about how we want to handle this case and what meaning the path parameter has. But we should definitely add some test cases around those weird cases and adjust the behavior. Thanks for raising the issue! |
Added some test cases for this, but it seems to work fine thou? 31 |
Yes but that's not really the expected behavior is it? I think an empty path should mean the current object, instead of a key with an empty string and the code seems to agree, https://github.com/clickbar/dot-diver/blob/main/src/index.ts#L286 But this line would never happen because array pop on a split string will always return a string, never undefined |
I agree on that and will include the change as part of the next major release. Currently trying to optimize performance here, so that should (hopefully) not be to far off. And yes, the check is useless and only exists to satisfy the typescript compiler, it will also get removed. |
Expected
The text was updated successfully, but these errors were encountered: