diff options
author | Jo-Philipp Wich <jo@mein.io> | 2022-01-07 12:15:48 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-07 12:15:48 +0100 |
commit | 0e5b273c3d25d1dce3b469f3a6865f430554e730 (patch) | |
tree | ee77f90f841e92f300b89eecd1498597ad4de068 /README.md | |
parent | 3f56b955e3ef14aca7193ba3a9a4c047e07fe7f7 (diff) | |
parent | eafa321279778d737861c57437fe4fc14c26d36e (diff) |
Merge pull request #31 from jow-/add-uniq
lib: implement uniq() function
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -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 +``` |