@@ -20,6 +20,7 @@ import assert from 'assert';
20
20
import { FirebaseApp , initializeApp } from '@firebase/app' ;
21
21
import { expect } from 'chai' ;
22
22
import * as chai from 'chai' ;
23
+ import _ from 'lodash' ;
23
24
import sinonChai from 'sinon-chai' ;
24
25
25
26
import {
@@ -72,37 +73,6 @@ function objectMap(object, mapFn) {
72
73
return newObj ;
73
74
}
74
75
75
- function unsafeClone ( obj ) {
76
- if ( ! obj || typeof obj !== 'object' ) {
77
- return obj ;
78
- }
79
- if ( typeof obj . clone === 'function' ) {
80
- return obj . clone ( ) ;
81
- }
82
- if ( typeof Map !== 'undefined' && obj instanceof Map ) {
83
- return new Map ( obj ) ;
84
- } else if ( typeof Set !== 'undefined' && obj instanceof Set ) {
85
- return new Set ( obj ) ;
86
- } else if ( obj instanceof Date ) {
87
- return new Date ( obj . getTime ( ) ) ;
88
- }
89
- const clone = Array . isArray ( obj )
90
- ? [ ]
91
- : typeof ArrayBuffer === 'function' &&
92
- typeof ArrayBuffer . isView === 'function' &&
93
- ArrayBuffer . isView ( obj ) &&
94
- ! ( obj instanceof DataView )
95
- ? // @ts -ignore
96
- new obj . constructor ( obj . length )
97
- : { } ;
98
-
99
- // eslint-disable-next-line guard-for-in
100
- for ( const key in obj ) {
101
- clone [ key ] = unsafeClone ( obj [ key ] ) ;
102
- }
103
- return clone ;
104
- }
105
-
106
76
// eslint-disable-next-line @typescript-eslint/ban-types
107
77
function removeIf < T > ( array : T [ ] , callback : Function ) {
108
78
let i = 0 ;
@@ -435,8 +405,8 @@ export class SyncPointTestParser {
435
405
const registrations = { } ;
436
406
437
407
for ( let i = 0 ; i < testSpec . steps . length ; ++ i ) {
438
- // TODO: Create a separate object structure specifically for the steps.
439
- const spec = unsafeClone ( testSpec . steps [ i ] ) ;
408
+ // TODO: Create a separate object structure specifically for the steps
409
+ const spec = _ . cloneDeep ( testSpec . steps [ i ] ) ;
440
410
if ( '.comment' in spec ) {
441
411
console . log ( ' > ' + spec [ '.comment' ] ) ;
442
412
}
0 commit comments