Jsonpatch v0.6.2 Jsonpatch.Operation.Add View Source

The add operation is the operation for adding (as you might guess) values to a map or struct.

Link to this section Summary

Functions

Applies an add operation a struct/map.

Link to this section Types

Specs

t() :: %Jsonpatch.Operation.Add{path: String.t(), value: any()}

Link to this section Functions

Specs

apply_op(t(), map()) :: map()

Applies an add operation a struct/map.

Examples

iex> add = %Jsonpatch.Operation.Add{path: "/a/b", value: 1}
iex> target = %{"a" => %{"c" => false}}
iex> Jsonpatch.Operation.Add.apply_op(add, target)
%{"a" => %{"b" => 1, "c" => false}}