mirror of
https://github.com/S2-/securerandomstring.git
synced 2025-08-02 18:30:04 +02:00
Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
f7e565bcc7 | |||
f82de05f4b |
@@ -31,6 +31,9 @@ function srs(options, cb) {
|
|||||||
} else {
|
} else {
|
||||||
string = string.replace(/\//g, '_').replace(/\+/g, '-');
|
string = string.replace(/\//g, '_').replace(/\+/g, '-');
|
||||||
}
|
}
|
||||||
|
if (string.length < length) {
|
||||||
|
throw new Error(`Generated string is too short. Please catch this Error and try again.`);
|
||||||
|
}
|
||||||
return string.substr(0, length);
|
return string.substr(0, length);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "secure-random-string",
|
"name": "secure-random-string",
|
||||||
"version": "1.1.2",
|
"version": "1.1.3",
|
||||||
"description": "Generates a secure random string with a given length",
|
"description": "Generates a secure random string with a given length",
|
||||||
"main": "lib/secure-random-string.js",
|
"main": "lib/secure-random-string.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
Reference in New Issue
Block a user