Skip to content

Commit 0094162

Browse files
committed
perf: delete unused code
1 parent c171992 commit 0094162

File tree

4 files changed

+4
-103
lines changed

4 files changed

+4
-103
lines changed

src/utils/index.js

Lines changed: 0 additions & 79 deletions
This file was deleted.

src/utils/validate.js

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,6 @@ export function isvalidUsername(str) {
77
return valid_map.indexOf(str.trim()) >= 0
88
}
99

10-
/* 合法uri*/
11-
export function validateURL(textval) {
12-
const urlregex = /^(https?|ftp):\/\/([a-zA-Z0-9.-]+(:[a-zA-Z0-9.&%$-]+)*@)*((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3}|([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2}))(:[0-9]+)*(\/($|[a-zA-Z0-9.,?'\\+&%$#=~_-]+))*$/
13-
return urlregex.test(textval)
14-
}
15-
16-
/* 小写字母*/
17-
export function validateLowerCase(str) {
18-
const reg = /^[a-z]+$/
19-
return reg.test(str)
20-
}
21-
22-
/* 大写字母*/
23-
export function validateUpperCase(str) {
24-
const reg = /^[A-Z]+$/
25-
return reg.test(str)
26-
}
27-
28-
/* 大小写字母*/
29-
export function validatAlphabets(str) {
30-
const reg = /^[A-Za-z]+$/
31-
return reg.test(str)
10+
export function isExternal(path) {
11+
return /^(https?:|mailto:|tel:)/.test(path)
3212
}

src/views/layout/components/Sidebar/Link.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
</template>
88

99
<script>
10-
import { isExternal } from '@/utils'
10+
import { isExternal } from '@/utils/validate'
1111
1212
export default {
1313
props: {

src/views/layout/components/Sidebar/SidebarItem.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535

3636
<script>
3737
import path from 'path'
38-
import { isExternal } from '@/utils'
38+
import { isExternal } from '@/utils/validate'
3939
import Item from './Item'
4040
import AppLink from './Link'
4141

0 commit comments

Comments
 (0)