File tree Expand file tree Collapse file tree 2 files changed +18
-13
lines changed Expand file tree Collapse file tree 2 files changed +18
-13
lines changed Original file line number Diff line number Diff line change @@ -48,3 +48,20 @@ export function getAndRemoveConfig(str = '') {
48
48
export function removeAtag ( str = '' ) {
49
49
return str . replace ( / ( < \/ ? a .* ?> ) / gi, '' ) ;
50
50
}
51
+
52
+ /**
53
+ * Escape html
54
+ * @param {String } string html string
55
+ * @returns {string } Return escaped html string
56
+ */
57
+ export function escapeHtml ( string ) {
58
+ const entityMap = {
59
+ '&' : '&' ,
60
+ '<' : '<' ,
61
+ '>' : '>' ,
62
+ '"' : '"' ,
63
+ "'" : ''' ,
64
+ } ;
65
+
66
+ return String ( string ) . replace ( / [ & < > " ' ] / g, s => entityMap [ s ] ) ;
67
+ }
Original file line number Diff line number Diff line change 1
1
/* eslint-disable no-unused-vars */
2
- import { getAndRemoveConfig } from '../../core/render/utils' ;
2
+ import { getAndRemoveConfig , escapeHtml } from '../../core/render/utils' ;
3
3
4
4
let INDEXS = { } ;
5
5
@@ -20,18 +20,6 @@ function resolveIndexKey(namespace) {
20
20
: LOCAL_STORAGE . INDEX_KEY ;
21
21
}
22
22
23
- function escapeHtml ( string ) {
24
- const entityMap = {
25
- '&' : '&' ,
26
- '<' : '<' ,
27
- '>' : '>' ,
28
- '"' : '"' ,
29
- "'" : ''' ,
30
- } ;
31
-
32
- return String ( string ) . replace ( / [ & < > " ' ] / g, s => entityMap [ s ] ) ;
33
- }
34
-
35
23
function getAllPaths ( router ) {
36
24
const paths = [ ] ;
37
25
You can’t perform that action at this time.
0 commit comments