Skip to content
This repository was archived by the owner on Mar 3, 2022. It is now read-only.

Commit 6903f40

Browse files
committed
Merge branch 'enhancement/random-supports-window.crypto' into dev
2 parents e80358c + 8335caa commit 6903f40

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/random.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ var uuid4 = require('uuid/v4')
55
*/
66

77
export default function random() {
8-
return uuid4()
8+
return uuid4().replace(/-/g, '');
99
}

test/unit/random.spec.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import random from '../../src/random'
22

3-
const pattern = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/
3+
const pattern = /^[0-9a-f]{8}[0-9a-f]{4}4[0-9a-f]{3}[89ab][0-9a-f]{3}[0-9a-f]{12}$/
4+
//const pattern = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/
45

56

67
describe('random', function() {
7-
it('should return a valid RFC4122 v4 guid', function(){
8+
it('should return a valid RFC4122 v4 guid (sans dashes)', function(){
89
const rnd = random()
10+
console.log(rnd);
911
rnd.should.match(pattern)
1012
})
1113
})

0 commit comments

Comments
 (0)