Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { catchError, of } from 'rxjs';
- export function deepCopy(obj: any): any {
- if (Array.isArray(obj)) {
- return obj.map((item) => deepCopy(item));
- } else if (typeof obj === 'object' && obj !== null) {
- const newObj = {};
- for (const key in obj) {
- (newObj as any)[key] = deepCopy(obj[key]);
- }
- return newObj;
- } else {
- return obj;
- }
- }
- export function handleHttpError(errorMessage: string) {
- return catchError((error) => {
- console.error(errorMessage, error);
- return of(null);
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment