Passed
Push — develop ( b91919...1ff2d0 )
by Endre
05:15
created

RouterData.migrateRouterInternalToV102   A

Complexity

Conditions 2

Size

Total Lines 10
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 10
dl 0
loc 10
ccs 3
cts 3
cp 1
crap 2
rs 9.9
c 0
b 0
f 0
1
import {IPageData} from '@enbock/application-router/Router';
2
import {IObserver} from '@enbock/state-value-observer/Observer';
3
import {IModulePageData} from '../Application/Application';
4
5
export default class RouterData {
6
  private routerData: IObserver<IModulePageData | null>;
7
8
  constructor(routerData: IObserver<IPageData | null>) {
9 3
    this.routerData = routerData as IObserver<IModulePageData | null>;
10
  }
11
12
  migrateRouterInternalToV102(): void {
13 3
    const pageData: IPageData | null | any = this.routerData.value;
14 4
    if (pageData == null || pageData.rootUrl == undefined) return;
15
16 1
    this.routerData.value = {
17
      baseUrl: pageData.rootUrl,
18
      currentUrl: pageData.url,
19
      name: pageData.name,
20
      module: pageData.module
21
    };
22
  }
23
}
24