import { injectable } from "inversify" ; @ injectable ( ) export class UrlService { param urlA param urlB return hasSameOrigin ( urlA , urlB ) { return new URL ( urlA ) . origin === new URL ( urlB ) . origin ; } param url return getFileName ( url ) { const pathname = new URL ( url ) . pathname ; if ( ! pathname . includes ( "/" ) ) { return "" ; } return pathname . substr ( pathname . lastIndexOf ( "/" ) + 1 ) ; } }