Skip to content

Remove fails if the value for the key is undefined. #38

Description

@DaveEmmerson

A { a: undefined }
B {}
patch = diff(A,B) (results in 'remove a')
patchInPlace(patch, A)

fails with "path does not exist"

// key must exist for remove
if(notFound(pointer) || pointer.target[pointer.key] === void 0) {
	throw new InvalidPatchOperationError('path does not exist ' + change.path);
}

The cause is the check for pointer.target[pointer.key] not being undefined.
The key needs to be present, but if the value is undefined that shouldn't prevent a removal.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions