summaryrefslogtreecommitdiffhomepage
path: root/README.md
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2022-01-07 12:15:48 +0100
committerGitHub <noreply@github.com>2022-01-07 12:15:48 +0100
commit0e5b273c3d25d1dce3b469f3a6865f430554e730 (patch)
treeee77f90f841e92f300b89eecd1498597ad4de068 /README.md
parent3f56b955e3ef14aca7193ba3a9a4c047e07fe7f7 (diff)
parenteafa321279778d737861c57437fe4fc14c26d36e (diff)
Merge pull request #31 from jow-/add-uniq
lib: implement uniq() function
Diffstat (limited to 'README.md')
-rw-r--r--README.md13
1 files changed, 13 insertions, 0 deletions
diff --git a/README.md b/README.md
index 524f0c0..a078ce4 100644
--- a/README.md
+++ b/README.md
@@ -1254,3 +1254,16 @@ If a non-string argument is given, the function returns `null`.
b64enc("This is a test"); // "VGhpcyBpcyBhIHRlc3Q="
b64enc(123); // null
```
+
+#### 6.64. `uniq(array)`
+
+Returns a new array containing all unique values of the given input
+array. The order is preserved, that is subsequent duplicate values
+are simply skipped.
+
+If a non-array argument is given, the function returns `null`.
+
+```javascript
+uniq([ 1, true, "foo", 2, true, "bar", "foo" ]); // [ 1, true, "foo", 2, "bar" ]
+uniq("test"); // null
+```