export class HelperFunctions { //Use this class function to create queryParams Objects in format {key1:value1} or {key1:value1,key2:value2,key3:value3,...} for multiple parameters constructor() {} public static scroll() { if (typeof document !== 'undefined') { //this.element.nativeElement.scrollIntoView(); window.scrollTo(0, 0); } } public static isTiny(url: string) { return (url.indexOf('tinyurl.com') !== -1); } public static copy(element: any): any { // return JSON.parse(JSON.stringify(element)); // return { ...element}; return Object.assign(Object.create(element), element); } public static encodeArray(elements: string[]): string[] { let encoded: string[] = []; elements.forEach(element => { encoded.push(encodeURIComponent(element)); }); return encoded; } }