| Total Complexity | 3 |
| Total Lines | 20 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | import {IObserver} from '../../../Observer/Observer'; |
||
| 7 | |||
| 8 | export default class StyleUrlFormatter { |
||
| 9 | protected currentPage: IObserver<IPageData>; |
||
| 10 | |||
| 11 | constructor(currentPage: IObserver<IPageData>) { |
||
| 12 | this.currentPage = currentPage; |
||
| 13 | } |
||
| 14 | |||
| 15 | format(url: string): string { |
||
| 16 | const currentPage: IPageData = this.currentPage.value; |
||
| 17 | let pathOffset = './'; |
||
| 18 | if(currentPage.depth > 0) { |
||
| 19 | let index:number; |
||
| 20 | pathOffset = ''; |
||
| 21 | for(index = 0; index < currentPage.depth; index++) { |
||
| 22 | pathOffset += '../'; |
||
| 23 | } |
||
| 24 | } |
||
| 25 | |||
| 26 | return pathOffset + 'Style/' + url + '.css'; |
||
| 27 | } |
||
| 29 |