Skip to content

Commit 6ef703f

Browse files
committed
Merge pull request algorithm-visualizer#126 from nem035/small-cleanup
Cleanup
2 parents e437d72 + dc75261 commit 6ef703f

File tree

5 files changed

+20
-13
lines changed

5 files changed

+20
-13
lines changed

js/server/helpers.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ const setHashValue = (key, value)=> {
5858
}
5959

6060
const newHash = params.join('&');
61-
window.location.hash = '#' + newHash;
61+
window.location.hash = `#${newHash}`;
6262
};
6363

6464
const removeHashValue = (key) => {
@@ -75,19 +75,19 @@ const removeHashValue = (key) => {
7575
}
7676

7777
const newHash = params.join('&');
78-
window.location.hash = '#' + newHash;
78+
window.location.hash = `#${newHash}`;
7979
};
8080

8181
const setPath = (category, algorithm, file) => {
82-
const path = category ? category + (algorithm ? '/' + algorithm + (file ? '/' + file : '') : '') : '';
82+
const path = category ? category + (algorithm ? `/${algorithm}` + (file ? `/${file}` : '') : '') : '';
8383
setHashValue('path', path);
8484
};
8585

8686
const getPath = () => {
8787
const hash = getHashValue('path');
8888
if (hash) {
89-
const parts = hash.split('/');
90-
return {category: parts[0], algorithm: parts[1], file: parts[2]};
89+
const [ category, algorithm, file ] = hash.split('/');
90+
return { category, algorithm, file };
9191
} else {
9292
return false;
9393
}
@@ -101,4 +101,4 @@ module.exports = {
101101
removeHashValue,
102102
setPath,
103103
getPath
104-
};
104+
};

public/algorithm_visualizer.js

Lines changed: 10 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/algorithm_visualizer.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/algorithm_visualizer.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/algorithm_visualizer.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)