import { Pipe, PipeTransform } from '@angular/core';

@Pipe({
    name: "formatUrl"
})

export class formatUrlPipe implements PipeTransform {

	/**
     * Takes string and return the name of the document or page
     * that is referred to without GET variables
     * 
     * @param value 
     */
	transform(value: string): string {
		let formattedLink = value

        if(!!formattedLink.length) {
            let splitLink = value.split('/')
            formattedLink = splitLink[splitLink.length - 1].split('?')[0]
        }

        return formattedLink
	}
}