We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2e7f2c0 commit 140e741Copy full SHA for 140e741
patch.go
@@ -3,6 +3,7 @@ package jsonpatch
3
import (
4
"encoding/json"
5
"reflect"
6
+ "slices"
7
)
8
9
// JSONPatch format is specified in RFC 6902
@@ -40,13 +41,7 @@ func (l JSONPatchList) Raw() []byte {
40
41
42
// List returns a copy of the underlying JSONPatch slice
43
func (l JSONPatchList) List() []JSONPatch {
- ret := make([]JSONPatch, l.Len())
44
-
45
- for i, patch := range l.list {
46
- ret[i] = patch
47
- }
48
49
- return ret
+ return slices.Clone(l.list)
50
}
51
52
// CreateJSONPatch compares two JSON data structures and creates a JSONPatch according to RFC 6902
0 commit comments