-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
The current code is able to change values for selector paths which already exist in the obj. It would be nice if there were support for 'upsert' which would update a field if the selector path already exists, OR add a field and selector path if the path does not exist.
This following works, because the selector path ["a", "b"] already exists in the 'obj' {a: {b: "before"}.
m.change(["a", "b"], "after")({a: {b: "before"})
The result is:
{"a": {"b": "after"}}
It would be nice if
m.upsert(["a", "b"], "after")({}) // Note the empty obj({})
Would produce the same result as above, even though the selector path ["a", "b"] does not exist in the obj {}.
Metadata
Metadata
Assignees
Labels
No labels