1
0
mirror of https://github.com/S2-/securerandomstring.git synced 2025-08-02 18:30:04 +02:00

2 Commits

Author SHA1 Message Date
s2
f7e565bcc7 1.1.3 2020-04-08 18:20:02 +02:00
s2
f82de05f4b throw exception if string is not selected length 2020-04-08 18:19:54 +02:00
2 changed files with 4 additions and 1 deletions

View File

@@ -31,6 +31,9 @@ function srs(options, cb) {
} else {
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);
}
};

View File

@@ -1,6 +1,6 @@
{
"name": "secure-random-string",
"version": "1.1.2",
"version": "1.1.3",
"description": "Generates a secure random string with a given length",
"main": "lib/secure-random-string.js",
"scripts": {