summaryrefslogtreecommitdiff
path: root/src/prelude/array.ts
diff options
context:
space:
mode:
authorAya Morisawa <AyaMorisawa4869@gmail.com>2018-09-07 00:10:03 +0900
committersyuilo <Syuilotan@yahoo.co.jp>2018-09-07 00:10:03 +0900
commitff0a05a2d67f45ec9ff06d50c5be821d559c2528 (patch)
tree1f9017e908a4852d7a4c51a85f2c8cbaca2be79b /src/prelude/array.ts
parentFix bug (#2643) (diff)
downloadsharkey-ff0a05a2d67f45ec9ff06d50c5be821d559c2528.tar.gz
sharkey-ff0a05a2d67f45ec9ff06d50c5be821d559c2528.tar.bz2
sharkey-ff0a05a2d67f45ec9ff06d50c5be821d559c2528.zip
Add unique function (#2644)
Diffstat (limited to 'src/prelude/array.ts')
-rw-r--r--src/prelude/array.ts4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/prelude/array.ts b/src/prelude/array.ts
index a2a6bbd4c6..abef6ca039 100644
--- a/src/prelude/array.ts
+++ b/src/prelude/array.ts
@@ -17,3 +17,7 @@ export function intersperse<T>(sep: T, xs: T[]): T[] {
export function erase<T>(x: T, xs: T[]): T[] {
return xs.filter(y => x !== y);
}
+
+export function unique<T>(xs: T[]): T[] {
+ return [...new Set(xs)];
+}