summaryrefslogtreecommitdiff
path: root/src/prelude/array.ts
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2018-11-09 14:15:52 +0900
committersyuilo <syuilotan@yahoo.co.jp>2018-11-09 14:15:52 +0900
commit5b4205bdbc87f87c40fcf7c0d12e6451b18e0e20 (patch)
tree6a3749e442dbde768b6ea934c5929efb23e322cc /src/prelude/array.ts
parent[Client] Fix i18n (diff)
parentRename: setDifference -> difference (#3177) (diff)
downloadsharkey-5b4205bdbc87f87c40fcf7c0d12e6451b18e0e20.tar.gz
sharkey-5b4205bdbc87f87c40fcf7c0d12e6451b18e0e20.tar.bz2
sharkey-5b4205bdbc87f87c40fcf7c0d12e6451b18e0e20.zip
Merge branch 'develop' of https://github.com/syuilo/misskey into develop
Diffstat (limited to 'src/prelude/array.ts')
-rw-r--r--src/prelude/array.ts8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/prelude/array.ts b/src/prelude/array.ts
index 8536e486d6..69b52fde87 100644
--- a/src/prelude/array.ts
+++ b/src/prelude/array.ts
@@ -18,8 +18,12 @@ export function erase<T>(x: T, xs: T[]): T[] {
return xs.filter(y => x !== y);
}
-export function setDifference<T>(xs: T[], ys: T[]): T[] {
- return xs.filter(x => !ys.includes(x));
+/**
+ * Finds the array of all elements in the first array not contained in the second array.
+ * The order of result values are determined by the first array.
+ */
+export function difference<T>(includes: T[], excludes: T[]): T[] {
+ return includes.filter(x => !excludes.includes(x));
}
export function unique<T>(xs: T[]): T[] {