Comparing version 1.0.0 to 1.0.1
15
index.js
var crypto = require('crypto') | ||
var mz_crypto = require('mz/crypto') | ||
var pseudoRandomBytes = require('crypto').pseudoRandomBytes | ||
var escape = require('base64-url').escape | ||
var pseudoRandomBytesProm | ||
module.exports = uid | ||
@@ -10,3 +11,3 @@ | ||
if (cb) { | ||
return crypto.pseudoRandomBytes(length, function (err, buf) { | ||
return pseudoRandomBytes(length, function (err, buf) { | ||
if (err) return cb(err) | ||
@@ -16,7 +17,9 @@ cb(null, escapeBuffer(buf)) | ||
} | ||
return mz_crypto.pseudoRandomBytes(length).then(escapeBuffer) | ||
pseudoRandomBytesProm || (pseudoRandomBytesProm = require('mz/crypto').pseudoRandomBytes) | ||
return pseudoRandomBytesProm(length).then(escapeBuffer) | ||
} | ||
uid.sync = function (length) { | ||
return escapeBuffer(crypto.pseudoRandomBytes(length)) | ||
uid.sync = function uid_sync(length) { | ||
return escapeBuffer(pseudoRandomBytes(length)) | ||
} | ||
@@ -23,0 +26,0 @@ |
{ | ||
"name": "uid-safe", | ||
"description": "URL and cookie safe UIDs", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"author": { | ||
@@ -12,9 +12,9 @@ "name": "Jonathan Ong", | ||
"license": "MIT", | ||
"repository": "jonathanong/uid-safe", | ||
"repository": "crypto-utils/uid-safe", | ||
"dependencies": { | ||
"mz": "0", | ||
"bluebird": "2", | ||
"mz": "1", | ||
"base64-url": "1" | ||
}, | ||
"devDependencies": { | ||
"bluebird": "2", | ||
"mocha": "1" | ||
@@ -21,0 +21,0 @@ }, |
@@ -23,2 +23,5 @@ | ||
If `cb` is not defined, a promise is returned. | ||
However, to use promises, you must either install [bluebird](https://github.com/petkaantonov/bluebird) | ||
or use a version of node.js that has native promises, | ||
otherwise your process will crash and die. | ||
@@ -25,0 +28,0 @@ ```js |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
4638
2
59
45
2
+ Addedany-promise@1.3.0(transitive)
+ Addedmz@1.3.0(transitive)
+ Addednative-or-bluebird@1.2.0(transitive)
+ Addedthenify@3.3.1(transitive)
+ Addedthenify-all@1.6.0(transitive)
- Removedbluebird@2
- Removedbluebird@2.11.0(transitive)
- Removedmz@0.1.6(transitive)
Updatedmz@1