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

Why return path.length - 1 for object operations? #36

Open
happy15 opened this issue Jan 8, 2021 · 0 comments
Open

Why return path.length - 1 for object operations? #36

happy15 opened this issue Jan 8, 2021 · 0 comments

Comments

@happy15
Copy link

happy15 commented Jan 8, 2021

It makes sense to return path.length-1 as common length for list operations since the last element of path for list operations are index.

But why the same for object operations? If object operation A can be transformed regarding object operation B, A.p should be a strict prefix array of B.p. The part to transform object operations did that by checking c.p[common] and otherC.p[common] again.

From the code using the result common of json0.transformComponent(...) I see that it will access the last element by p[common], so it's just for implementation convenience (no more p[common-1]) or serve other purposes?

json0 rocks and looking forward to some hints.

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