diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2020-12-14 22:32:21 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-14 22:32:21 -0500 |
commit | cd82fe8aac88c03e85e01a267de976337412d338 (patch) | |
tree | 0e47938e826b0bbab363adf6277944d8c3684aae /dev | |
parent | 96e68be0fa56706d39d6a8aff12146f7f18cbc5d (diff) |
Add support for copy and move operations (#1111)
Diffstat (limited to 'dev')
-rw-r--r-- | dev/build.js | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/dev/build.js b/dev/build.js index b76a769b..52e7d541 100644 --- a/dev/build.js +++ b/dev/build.js @@ -122,6 +122,24 @@ function applyModifications(manifest, modifications) { value.splice(start, deleteCount, ...itemsNew); } break; + case 'copy': + { + const {newPath} = modification; + const value = getObjectProperties(manifest, path2, path2.length); + const newObject = getObjectProperties(manifest, newPath, newPath.length - 1); + newObject[newPath[newPath.length - 1]] = value; + } + break; + case 'move': + { + const {newPath} = modification; + const value = getObjectProperties(manifest, path2, path2.length); + const oldObject = getObjectProperties(manifest, path2, path2.length - 1); + const newObject = getObjectProperties(manifest, newPath, newPath.length - 1); + newObject[newPath[newPath.length - 1]] = value; + delete oldObject[path2[path2.length - 1]]; + } + break; } } } |