Add nested_update.in_place argument (#13)
* Add nested_update.in_place argument * Update README.rst and tests
This commit is contained in:
parent
8baf61f7e6
commit
a924829821
3 changed files with 21 additions and 7 deletions
|
|
@ -28,9 +28,10 @@ def _nested_delete(document, key):
|
|||
return document
|
||||
|
||||
|
||||
def nested_update(document, key, value):
|
||||
duplicate = copy.deepcopy(document)
|
||||
return _nested_update(document=duplicate, key=key, value=value)
|
||||
def nested_update(document, key, value, in_place=False):
|
||||
if not in_place:
|
||||
document = copy.deepcopy(document)
|
||||
return _nested_update(document=document, key=key, value=value)
|
||||
|
||||
|
||||
def _nested_update(document, key, value):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue