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;
|
if (ex) throw ex;
|
||||||
|
|
||||||
var string = buf.toString('base64');
|
var string = buf.toString('base64');
|
||||||
|
if (options.urlsafe) {
|
||||||
|
string = string.replace(/\//g,'_').replace(/\+/g,'-');
|
||||||
|
}
|
||||||
|
|
||||||
cb(string.substr(0, length));
|
cb(string.substr(0, length));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "securerandomstring",
|
"name": "securerandomstring",
|
||||||
"version": "0.0.2",
|
"version": "0.0.3",
|
||||||
"description": "Generates a secure random string with a given length",
|
"description": "Generates a secure random string with a given length",
|
||||||
"main": "lib/securerandomstring.js",
|
"main": "lib/securerandomstring.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
Reference in New Issue
Block a user