提交 3e9fc491 编写于 作者: N Nemanja Stojanovic

Merge pull request #126 from nem035/small-cleanup

Cleanup
...@@ -58,7 +58,7 @@ const setHashValue = (key, value)=> { ...@@ -58,7 +58,7 @@ const setHashValue = (key, value)=> {
} }
const newHash = params.join('&'); const newHash = params.join('&');
window.location.hash = '#' + newHash; window.location.hash = `#${newHash}`;
}; };
const removeHashValue = (key) => { const removeHashValue = (key) => {
...@@ -75,19 +75,19 @@ const removeHashValue = (key) => { ...@@ -75,19 +75,19 @@ const removeHashValue = (key) => {
} }
const newHash = params.join('&'); const newHash = params.join('&');
window.location.hash = '#' + newHash; window.location.hash = `#${newHash}`;
}; };
const setPath = (category, algorithm, file) => { const setPath = (category, algorithm, file) => {
const path = category ? category + (algorithm ? '/' + algorithm + (file ? '/' + file : '') : '') : ''; const path = category ? category + (algorithm ? `/${algorithm}` + (file ? `/${file}` : '') : '') : '';
setHashValue('path', path); setHashValue('path', path);
}; };
const getPath = () => { const getPath = () => {
const hash = getHashValue('path'); const hash = getHashValue('path');
if (hash) { if (hash) {
const parts = hash.split('/'); const [ category, algorithm, file ] = hash.split('/');
return {category: parts[0], algorithm: parts[1], file: parts[2]}; return { category, algorithm, file };
} else { } else {
return false; return false;
} }
...@@ -101,4 +101,4 @@ module.exports = { ...@@ -101,4 +101,4 @@ module.exports = {
removeHashValue, removeHashValue,
setPath, setPath,
getPath getPath
}; };
\ No newline at end of file
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册