-
Notifications
You must be signed in to change notification settings - Fork 6
/
utils.js
42 lines (34 loc) · 1.06 KB
/
utils.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
module.exports = {
isChinese(issue) {
const reg = new RegExp('[\u4e00-\u9fa5]')
return reg.test(issue.body) || reg.test(issue.title)
},
isValid(issue) {
return /generated by https:\/\/eleme-issue\.surge\.sh DO NOT REMOVE/.test(issue.body)
},
isBug(issue) {
return issue.title.indexOf('[Bug Report]') > -1
},
isFeature(issue) {
return issue.title.indexOf('[Feature Request]') > -1
},
hasReferenceLink(issue) {
return /###[\s\S]+(http|\[.+\]\(.+\))[\s\S]+<\!--/ig.test(issue.body)
},
isKeyEvent(issue) {
const content = issue.title + issue.body
return /input/ig.test(content) && /keyup/ig.test(content)
},
isIconDemand(issue) {
const content = issue.title + issue.body
return /图标/g.test(content) && /少/g.test(content)
},
isInvalidFiddle(issue) {
return issue.body.indexOf('jsfiddle.net/api/post/library/pure/') > -1
},
isWindows(issue) {
const OS = issue.body.match(/OS\/Browsers version([^#]*)/)
if (!OS || !OS[1]) return false
return /win/i.test(OS[1]) && !/mac/i.test(OS[1])
}
}