File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
packages/database/test/helpers Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change 15
15
* limitations under the License.
16
16
*/
17
17
18
- import { v4 as uuidv4 } from 'uuid' ;
19
18
20
19
import { Database , ref } from '../../src' ;
21
20
import { ConnectionTarget } from '../../src/api/test_access' ;
@@ -80,6 +79,18 @@ export function waitFor(waitTimeInMS: number) {
80
79
return new Promise ( resolve => setTimeout ( resolve , waitTimeInMS ) ) ;
81
80
}
82
81
82
+ /**
83
+ * Copied from https://stackoverflow.com/a/2117523
84
+ * TODO: extract this into @firebase/util
85
+ */
86
+ export function uuidv4 ( ) : string {
87
+ return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx' . replace ( / [ x y ] / g, c => {
88
+ const r = ( Math . random ( ) * 16 ) | 0 ,
89
+ v = c === 'x' ? r : ( r & 0x3 ) | 0x8 ;
90
+ return v . toString ( 16 ) ;
91
+ } ) ;
92
+ }
93
+
83
94
// Creates a unique reference using uuid
84
95
export function getUniqueRef ( db : Database ) {
85
96
const path = uuidv4 ( ) ;
You can’t perform that action at this time.
0 commit comments