Skip to content

Commit

Permalink
Update jp.Modify docs
Browse files Browse the repository at this point in the history
  • Loading branch information
ohler55 committed May 28, 2024
1 parent 089c3ea commit a3e5bee
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion jp/modify.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,15 @@ import (
"github.com/ohler55/ojg/gen"
)

// MustModify modifies matching nodes and panics on an expression error.
// MustModify modifies matching nodes and panics on an expression error. In
// go, maps can be modified in place as the map itself is modified. Slice
// elements can be replaced in place but elements can not be added or removed
// without potentially needing to replace the original slice with a new
// one. This function and the other jp.Modify functions allow a slice to be
// replaced by stopping at the parent of the target slice and applying a
// modifier function to the target which is then replaced in the
// parent. Without that functionality slice element can only be replaced.
//
// Modified elements replace the original element in the data. The modified
// data is returned. Unless the data is a slice and modified the returned data
// will be the same object as the original. The modifier function will be
Expand Down

0 comments on commit a3e5bee

Please sign in to comment.