1
0
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:
s2
2015-04-22 23:48:08 +02:00
parent e343e69895
commit 25af4ef420
3 changed files with 12 additions and 1 deletions

View File

@@ -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));
});