fix issue where the first relationship of a type wouldn't be added

This commit is contained in:
Art Lowel
2020-04-02 10:22:08 +02:00
parent 6dbc2ef880
commit 29e6f6f72f
10 changed files with 82 additions and 7 deletions

View File

@@ -294,6 +294,20 @@ function flushOperation(state: JsonPatchOperationsState, action: FlushPatchOpera
}
}
/**
* Add a new operation to a patch
*
* @param body
* The current patch
* @param actionType
* The type of operation to add
* @param targetPath
* The path for the operation
* @param value
* The new value
* @param fromPath
* The previous path (in case of a move operation)
*/
function addOperationToList(body: JsonPatchOperationObject[], actionType, targetPath, value?, fromPath?) {
const newBody = Array.from(body);
switch (actionType) {