aboutsummaryrefslogtreecommitdiff
path: root/src/client/northstar/utils/ArrayUtil.ts
diff options
context:
space:
mode:
authorFawn <fangrui_tong@brown.edu>2019-04-15 15:32:46 -0400
committerFawn <fangrui_tong@brown.edu>2019-04-15 15:32:46 -0400
commit63ad49ff966d3c3f29bbe2c4d9758527f405bb6a (patch)
tree5f3f5b48b423b602ddee74d48a3ceaa487f3aad3 /src/client/northstar/utils/ArrayUtil.ts
parente81c43baadcaf31314c07505fa7cde70e709706d (diff)
parent6c0b421db6aa3204bbc6e42139d240f503000b5d (diff)
fixed merge
Diffstat (limited to 'src/client/northstar/utils/ArrayUtil.ts')
-rw-r--r--src/client/northstar/utils/ArrayUtil.ts16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/client/northstar/utils/ArrayUtil.ts b/src/client/northstar/utils/ArrayUtil.ts
index f35c98317..12b8d8e77 100644
--- a/src/client/northstar/utils/ArrayUtil.ts
+++ b/src/client/northstar/utils/ArrayUtil.ts
@@ -7,14 +7,14 @@ export class ArrayUtil {
return false;
}
let isComplex = typeof arr1[0] === "object";
- for (let i = 0; i < arr1.length; i++) {
- if (isComplex && "Equals" in arr1[i]) {
- if (arr1[i].Equals(arr2)) {
+ for (const ele of arr1) {
+ if (isComplex && "Equals" in ele) {
+ if (ele.Equals(arr2)) {
return true;
}
}
else {
- if (arr1[i] === arr2) {
+ if (ele === arr2) {
return true;
}
}
@@ -50,7 +50,7 @@ export class ArrayUtil {
if (filtered.length > 0) {
return filtered[0];
}
- throw new Exception()
+ throw new Exception();
}
public static FirstOrDefault<T>(arr: T[], predicate: (x: any) => boolean): T | undefined {
@@ -63,9 +63,9 @@ export class ArrayUtil {
public static Distinct(arr: any[]): any[] {
let ret = [];
- for (let i = 0; i < arr.length; i++) {
- if (!ArrayUtil.Contains(ret, arr[i])) {
- ret.push(arr[i]);
+ for (const ele of arr) {
+ if (!ArrayUtil.Contains(ret, ele)) {
+ ret.push(ele);
}
}
return ret;