feat(*): 代码仓库初始化
This commit is contained in:
12
Server/2/utils.js
Normal file
12
Server/2/utils.js
Normal file
@@ -0,0 +1,12 @@
|
||||
const word_count = function (text) {
|
||||
const text_list = text.replace(/[、\r?\n,,\s]+/g, " ").split(" ");
|
||||
let word_obj = {};
|
||||
for (const word of text_list) {
|
||||
word_obj[word] = (word_obj[word] || 0) + 1;
|
||||
}
|
||||
return word_obj;
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
word_count,
|
||||
};
|
||||
Reference in New Issue
Block a user