-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: keyboard shortcuts in selection lists
- Loading branch information
1 parent
b0b7859
commit e7e73c8
Showing
2 changed files
with
37 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
function arraysEqual<T>(a: T[], b: T[]): boolean { | ||
if (a === b) { | ||
return true; | ||
} | ||
if (a == null || b == null) { | ||
return false; | ||
} | ||
if (a.length !== b.length) { | ||
return false; | ||
} | ||
|
||
// If you don't care about the order of the elements inside | ||
// the array, you should sort both arrays here. | ||
// Please note that calling sort on an array will modify that array. | ||
// you might want to clone your array first. | ||
|
||
for (let i = 0; i < a.length; ++i) { | ||
if (a[i] !== b[i]) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
} | ||
|
||
export default arraysEqual; |