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

Merge pull request #126 from nem035/small-cleanup

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