Skip to content
This repository has been archived by the owner on Mar 29, 2023. It is now read-only.

Commit

Permalink
Add prepend function for object
Browse files Browse the repository at this point in the history
  • Loading branch information
TobiasNx committed Feb 1, 2022
1 parent d3ebe83 commit dfe0804
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 9 deletions.
3 changes: 2 additions & 1 deletion data/testing/appendArray_objects/animalsObjects.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
{"animal": "cat"}
],
"others": {"animal": "human"},
"fictional": {"animal": "unicorn"}
"fictional": {"animal": "unicorn"},
"exstinct": {"animal": "dodo"}
}
29 changes: 22 additions & 7 deletions data/testing/appendArray_objects/expected_object.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,25 @@
{
"animals":[
{"animal": "dog"},
{"animal": "cat"},
{"animal": "human"},
{"animal": "unicorn"},
{"animal": "earthworm"}
"animals": [
{
"animal": "dodo"
},
{
"animal": "dog"
},
{
"animal": "cat"
},
{
"animal": "human"
},
{
"animal": "unicorn"
},
{
"animal": "earthworm"
}
],
"others": {"animal": "human"}
"others": {
"animal": "human"
}
}
3 changes: 3 additions & 0 deletions data/testing/appendArray_objects/result_object.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,8 @@
} ],
"others" : {
"animal" : "human"
},
"exstinct" : {
"animal" : "dodo"
}
}
4 changes: 3 additions & 1 deletion data/testing/appendArray_objects/test_append_object.fix
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ copy_field("others", "animals[].$append")

move_field("fictional", "animals[].$append")

add_field("animals[].$append.animal", "earthworm")
add_field("animals[].$append.animal", "earthworm")

copy_field("extinct", "animals[].$prepend")

0 comments on commit dfe0804

Please sign in to comment.