mirror of
https://github.com/S2-/securerandomstring.git
synced 2025-08-02 10:20:05 +02:00
add urlsafe parameter
This commit is contained in:
@@ -13,6 +13,10 @@ function securerandomstring(options, cb) {
|
||||
if (ex) throw ex;
|
||||
|
||||
var string = buf.toString('base64');
|
||||
if (options.urlsafe) {
|
||||
string = string.replace(/\//g,'_').replace(/\+/g,'-');
|
||||
}
|
||||
|
||||
cb(string.substr(0, length));
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user