Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/unique-slug/index.js')
-rw-r--r--node_modules/unique-slug/index.js10
1 files changed, 1 insertions, 9 deletions
diff --git a/node_modules/unique-slug/index.js b/node_modules/unique-slug/index.js
index 7c5d6c751..fa4761ad2 100644
--- a/node_modules/unique-slug/index.js
+++ b/node_modules/unique-slug/index.js
@@ -1,5 +1,4 @@
'use strict'
-var crypto = require('crypto')
var MurmurHash3 = require('imurmurhash')
module.exports = function (uniq) {
@@ -7,13 +6,6 @@ module.exports = function (uniq) {
var hash = new MurmurHash3(uniq)
return ('00000000' + hash.result().toString(16)).substr(-8)
} else {
- // Called without a callback, because this interface should neither block
- // nor error (by contrast with randomBytes which will throw an exception
- // without enough entropy).
- //
- // However, due to a change in Node 0.10.27+, pseudoRandomBytes is now the
- // same as randomBytes, and may in fact block in situations where
- // insufficent entropy is available.
- return crypto.pseudoRandomBytes(4).toString('hex')
+ return (Math.random().toString(16) + '0000000').substr(2, 8)
}
}