Skip to content

Commit

Permalink
common/maps: Add Scratch.DeleteInMap
Browse files Browse the repository at this point in the history
Add Scratch.DeleteInMap method. This method works similar to Scratch.SetInMap. It takes in two string parameters, key and mapKey and deletes the value mapped to mapKey in key

Closes #8504
  • Loading branch information
satya-nutella authored May 17, 2021
1 parent b9cd771 commit 7dc282e
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions content/en/functions/scratch.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,18 @@ Takes a `key`, `mapKey` and `value` and add a map of `mapKey` and `value` to the
{{ .Scratch.Get "greetings" }} > map[french:Bonjour english:Hello]
```

#### .DeleteInMap
Takes a `key` and `mapKey` and removes the map of `mapKey` from the given `key`.

```go-html-template
{{ .Scratch.SetInMap "greetings" "english" "Hello" }}
{{ .Scratch.SetInMap "greetings" "french" "Bonjour" }}
----
{{ .Scratch.DeleteInMap "greetings" "english" }}
----
{{ .Scratch.Get "greetings" }} > map[french:Bonjour]
```

#### .GetSortedMapValues
Returns array of values from `key` sorted by `mapKey`

Expand Down

0 comments on commit 7dc282e

Please sign in to comment.