Skip to content

Commit

Permalink
Merge branch 'enhancement/random-supports-window.crypto' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
brockallen committed Mar 9, 2019
2 parents e80358c + 8335caa commit 6903f40
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/random.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ var uuid4 = require('uuid/v4')
*/

export default function random() {
return uuid4()
return uuid4().replace(/-/g, '');
}
6 changes: 4 additions & 2 deletions test/unit/random.spec.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import random from '../../src/random'

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


describe('random', function() {
it('should return a valid RFC4122 v4 guid', function(){
it('should return a valid RFC4122 v4 guid (sans dashes)', function(){
const rnd = random()
console.log(rnd);
rnd.should.match(pattern)
})
})
Expand Down

0 comments on commit 6903f40

Please sign in to comment.