mirror of
https://github.com/S2-/securerandomstring.git
synced 2025-08-02 10:20:05 +02:00
change api. i don't know what i was thinking.
This commit is contained in:
@@ -1,7 +1,12 @@
|
||||
var crypto = require('crypto');
|
||||
|
||||
function securerandomstring(cb, options) {
|
||||
options = options || {};
|
||||
function securerandomstring(options, cb) {
|
||||
if (typeof(options) === 'function') {
|
||||
cb = options;
|
||||
options = {};
|
||||
} else {
|
||||
options = options || {};
|
||||
}
|
||||
var length = options['length'] || 32;
|
||||
|
||||
crypto.randomBytes(length, function(ex, buf) {
|
||||
|
Reference in New Issue
Block a user