Total Complexity | 3 |
Complexity/F | 3 |
Lines of Code | 15 |
Function Count | 1 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | export default function (to, from, savedPosition) { |
||
2 | if (savedPosition) { |
||
3 | return savedPosition |
||
4 | } |
||
5 | if (to.hash) { |
||
6 | return window.scrollTo({ |
||
7 | top: document.querySelector(to.hash).offsetTop, |
||
8 | behavior: 'smooth' |
||
9 | }) |
||
10 | } |
||
11 | return window.scrollTo({ |
||
12 | top: 0, |
||
13 | behavior: 'smooth' |
||
14 | }) |
||
15 | } |
||
16 |