diff options
Diffstat (limited to 'model/map.go')
-rw-r--r-- | model/map.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/model/map.go b/model/map.go index 59ba2d8..7bfdaa3 100644 --- a/model/map.go +++ b/model/map.go @@ -41,3 +41,12 @@ func (n *Node) Map(cb func(key string, value *Node) (*Node, error)) error { } return nil } + +// Remove by key from object +func (n *Node) Remove(key string) error { + if n.Type != ObjectNode { + return fmt.Errorf("node must be object, got %s", n.Type) + } + delete(n.objectValue, key) + return nil +} |