mirror of
https://github.com/vector-im/element-call.git
synced 2026-10-10 23:25:52 +00:00
Let layoutShallowEquals compare any layout-shaped object
This commit is contained in:
@@ -150,10 +150,11 @@ export type Layout =
|
|||||||
| PipLayout;
|
| PipLayout;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests whether the top-level properties and array elements of layout `a` are
|
* Tests whether the top-level properties and array elements of `a` are equal
|
||||||
* equal to those of layout `b`. Useful for deduping redundant layout updates.
|
* to those of `b`. Useful for deduping redundant layout and layout media
|
||||||
|
* updates.
|
||||||
*/
|
*/
|
||||||
export function layoutShallowEquals(a: Layout, b: Layout): boolean {
|
export function layoutShallowEquals<T extends object>(a: T, b: T): boolean {
|
||||||
// If a and b have the same number of keys and every key in a is also in b,
|
// If a and b have the same number of keys and every key in a is also in b,
|
||||||
// then they have the same keys.
|
// then they have the same keys.
|
||||||
const aKeys = Object.keys(a);
|
const aKeys = Object.keys(a);
|
||||||
|
|||||||
Reference in New Issue
Block a user