web/client/app/router.scrollBehavior.js   A
last analyzed

Complexity

Total Complexity 3
Complexity/F 3

Size

Lines of Code 15
Function Count 1

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 10
mnd 2
bc 2
fnc 1
dl 0
loc 15
rs 10
bpm 2
cpm 3
noi 0
c 0
b 0
f 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