service refactor to namespaces
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
export class UtilService {
|
||||
public static addMonths(date: Date, months: number): Date {
|
||||
export namespace UtilService {
|
||||
export function addMonths(date: Date, months: number): Date {
|
||||
const d = date.getDate();
|
||||
date.setMonth(date.getMonth() + +months);
|
||||
if (date.getDate() != d) {
|
||||
@@ -8,12 +8,12 @@ export class UtilService {
|
||||
return date;
|
||||
}
|
||||
|
||||
public static getErrorMessage(error: unknown) {
|
||||
export function getErrorMessage(error: unknown) {
|
||||
if (error instanceof Error) return error.message;
|
||||
return String(error);
|
||||
}
|
||||
|
||||
public static stringifySafely(obj: any) {
|
||||
export function stringifySafely(obj: any) {
|
||||
let cache: any[] = [];
|
||||
let str = JSON.stringify(obj, function (key, value) {
|
||||
if (typeof value === 'object' && value !== null) {
|
||||
|
||||
Reference in New Issue
Block a user