openaire-library/utils/HelperFunctions.class.ts

20 lines
553 B
TypeScript

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));
}
}