perf: 优化内存占用

This commit is contained in:
xiaojunnuo
2024-08-28 14:40:50 +08:00
parent 42a56b581d
commit db61033633
15 changed files with 98 additions and 80 deletions
+2 -3
View File
@@ -7,7 +7,7 @@ const specials = '~!@#$%^*()_+-=[]{}|;:,./<>?';
* @param {Number} length
* @param {Object} options
*/
function randomStr(length, options) {
function randomStr(length, options?) {
length || (length = 8);
options || (options = {});
@@ -28,8 +28,7 @@ function randomStr(length, options) {
}
if (options.specials) {
chars +=
typeof options.specials === 'string' ? options.specials : specials;
chars += typeof options.specials === 'string' ? options.specials : specials;
}
}