Closed MikeRalphson closed 4 years ago
That was an oversight, it should be supported.
No default values should be inserted. Attempting to access a -
segment should result in the normal error Value at '${cursor}' does not have index '${segment}'
except segment
should be the computed index rather than -
.
That means
-
is only valid as the last element of a pointer.get
should error with the computed indexdelete
and unset
should do nothing. Deleting something that doesn't exist is still a no-op, not an error.set
and assign
should compute the index and assign the value to that index, but it will throw the normal does-not-have-index error if there are segments beyond -
.Thanks for finding this and for working on a fix. I'm hopeful that this should just be a fairly small change to the applySegment
function.
Published as v0.7.0
I can't see any support or tests for the last paragraph of this section of RFC 6901:
Should this be called out in the
README
as unsupported / always throwing an error?I'm thinking specifically about this paragraph too:
If you think supporting this is in scope, could you summarise your expectations for
get
,set
andassign
, and I could work up a PR?