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
modifyPath does not work for empty array path #3340
Comments
What path would an empty array represent? This is what works: modifyPath([0], append(1), [[]]);
// -> [[1]] |
Shouldn't an empty path point to the supplied object?
But the function has a guard fast returning the final argument in case of an empty path
Something like this would satisfy what's being asked:
I'm not sure if this goes against any of the principles of the library though. Or if its really that useful to support something like this. |
@JuanGalilea yep, that is what I meant, thanks. |
Finally brought myself to open a pull request for this. Checked all other path functions, all of them already supported this behaviour (except for |
In this case nothing happens:
modifyPath([], append(1), [])
=>[]
But logically
modifyPath
should apply function for empty array and in result there should be[1]
and not[]
But actual output is an empty array
[]
The text was updated successfully, but these errors were encountered: