mirror of
https://gitea.com/Lydanne/issues-helper.git
synced 2025-08-20 02:35:58 +08:00
perf: optimize duplicate (#24)
* perf: optimize mark duplicate * add * add * add * add * add
This commit is contained in:
16
src/util.js
16
src/util.js
@@ -11,11 +11,25 @@ function dealInput (para) {
|
||||
return arr;
|
||||
};
|
||||
|
||||
function matchKeyword(content, keywords) {
|
||||
function matchKeyword (content, keywords) {
|
||||
return keywords.find(item => content.toLowerCase().includes(item));
|
||||
};
|
||||
|
||||
function testDuplicate(body) {
|
||||
if (!body || !body.startsWith('Duplicate of')) {
|
||||
return false
|
||||
}
|
||||
|
||||
let arr = body.split(' ');
|
||||
if (arr[0] == 'Duplicate' && arr[1] == 'of') {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
dealInput,
|
||||
matchKeyword,
|
||||
testDuplicate,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user