summaryrefslogtreecommitdiffhomepage
path: root/packages/app/src/utils
diff options
context:
space:
mode:
Diffstat (limited to 'packages/app/src/utils')
-rw-r--r--packages/app/src/utils/same.ts6
1 files changed, 6 insertions, 0 deletions
diff --git a/packages/app/src/utils/same.ts b/packages/app/src/utils/same.ts
new file mode 100644
index 000000000..c956f9299
--- /dev/null
+++ b/packages/app/src/utils/same.ts
@@ -0,0 +1,6 @@
+export function same<T>(a: readonly T[] | undefined, b: readonly T[] | undefined) {
+ if (a === b) return true
+ if (!a || !b) return false
+ if (a.length !== b.length) return false
+ return a.every((x, i) => x === b[i])
+}