typo: 代码注释

This commit is contained in:
bietiaop 2024-07-15 14:25:42 +08:00
parent 51b3908afd
commit 4c90ca5354
12 changed files with 457 additions and 139 deletions

26
utils/data.js Normal file
View file

@ -0,0 +1,26 @@
/**
* 生成随机字符串
* @param {number} length 长度
* @returns {string}
*/
export const randomString = length => {
let randomStr = '';
for (let i = 0; i < length; i++) {
randomStr += _.sample('abcdefghijklmnopqrstuvwxyz0123456789');
}
return randomStr;
};
/**
* 生成随机种子
* @param {number} length 长度
* @returns {string}
*/
export const generateSeed = (length = 16) => {
const characters = '0123456789abcdef';
let result = '';
for (let i = 0; i < length; i++) {
result += characters[Math.floor(Math.random() * characters.length)];
}
return result;
};