Skip to content

Commit 38ffc85

Browse files
committed
util.js: move variable outside of the function
1 parent 0ed16b3 commit 38ffc85

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

lib/util.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
'use strict';
22

3-
function encode(string) {
4-
const pairs = {
5-
'&': '&',
6-
'"': '"',
7-
'\'': ''',
8-
'<': '&lt;',
9-
'>': '&gt;'
10-
};
3+
const pairs = {
4+
'&': '&amp;',
5+
'"': '&quot;',
6+
'\'': '&apos;',
7+
'<': '&lt;',
8+
'>': '&gt;'
9+
};
1110

11+
function encode(string) {
1212
for (const symbol in pairs) {
1313
if (typeof string !== 'undefined') {
1414
string = string.replace(new RegExp(symbol, 'g'), pairs[symbol]);

0 commit comments

Comments
 (0)