Skip to content
This repository has been archived by the owner on May 21, 2019. It is now read-only.

Commit

Permalink
Reduce code
Browse files Browse the repository at this point in the history
  • Loading branch information
ekaragodin committed Jun 19, 2016
1 parent 5a4bc6e commit f4d0d3f
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/views/1_ApplicationComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,7 @@ export class ApplicationComponent extends React.Component<{}, State> {
}

if (event.metaKey && event.keyCode >= KeyCode.One && event.keyCode <= KeyCode.Nine) {
let newTabIndex = parseInt(event.key, 10) - 1;

if (newTabIndex === 8) {
newTabIndex = this.tabs.length - 1;
}
const newTabIndex = (event.keyCode === KeyCode.Nine ? this.tabs.length : parseInt(event.key, 10)) - 1;

if (this.tabs.length > newTabIndex) {
this.activeTabIndex = newTabIndex;
Expand Down

0 comments on commit f4d0d3f

Please sign in to comment.