summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorSébastien d'Herbais de Thun <sebastien.d.herbais@gmail.com>2023-07-18 15:23:56 +0200
committerGitHub <noreply@github.com>2023-07-18 15:23:56 +0200
commit0c94d2b34e77edbd116c9f7be591ca710363b844 (patch)
treeaf93fac42444953d8a744bcd3f68300c1dc7fef3 /docs
parente43903d625f1009befe4f2341e52a720d657ad05 (diff)
Adding `dedup` to `array` (#1738)
Diffstat (limited to 'docs')
-rw-r--r--docs/reference/types.md15
1 files changed, 15 insertions, 0 deletions
diff --git a/docs/reference/types.md b/docs/reference/types.md
index 28646cd2..d602bc3e 100644
--- a/docs/reference/types.md
+++ b/docs/reference/types.md
@@ -966,6 +966,21 @@ Return a new array with the same items, but sorted.
If given, applies this function to the elements in the array to determine the keys to sort by.
- returns: array
+### dedup()
+Returns a new array with all duplicate items removed.
+
+Only the first element of each duplicate is kept.
+
+```example
+#{
+ (1, 1, 2, 3, 1).dedup() == (1, 2, 3)
+}
+```
+
+- key: function (named)
+ If given, applies this function to the elements in the array to determine the keys to deduplicate by.
+- returns: array
+
# Dictionary
A map from string keys to values.