26
26
const {
27
27
Array,
28
28
ArrayIsArray,
29
+ Int8Array,
29
30
MathAbs,
30
31
NumberIsFinite,
31
32
ObjectCreate,
@@ -54,7 +55,7 @@ const QueryString = module.exports = {
54
55
decode : parse
55
56
} ;
56
57
57
- const unhexTable = [
58
+ const unhexTable = new Int8Array ( [
58
59
- 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , // 0 - 15
59
60
- 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , // 16 - 31
60
61
- 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , // 32 - 47
@@ -71,7 +72,7 @@ const unhexTable = [
71
72
- 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 ,
72
73
- 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 ,
73
74
- 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 // ... 255
74
- ] ;
75
+ ] ) ;
75
76
// A safe fast alternative to decodeURIComponent
76
77
function unescapeBuffer ( s , decodeSpaces ) {
77
78
const out = Buffer . allocUnsafe ( s . length ) ;
@@ -131,7 +132,7 @@ function qsUnescape(s, decodeSpaces) {
131
132
// digits
132
133
// alpha (uppercase)
133
134
// alpha (lowercase)
134
- const noEscape = [
135
+ const noEscape = new Int8Array ( [
135
136
0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , // 0 - 15
136
137
0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , // 16 - 31
137
138
0 , 1 , 0 , 0 , 0 , 0 , 0 , 1 , 1 , 1 , 1 , 0 , 0 , 1 , 1 , 0 , // 32 - 47
@@ -140,7 +141,7 @@ const noEscape = [
140
141
1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 0 , 0 , 0 , 0 , 1 , // 80 - 95
141
142
0 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , // 96 - 111
142
143
1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 0 , 0 , 0 , 1 , 0 // 112 - 127
143
- ] ;
144
+ ] ) ;
144
145
// QueryString.escape() replaces encodeURIComponent()
145
146
// https://www.ecma-international.org/ecma-262/5.1/#sec-15.1.3.4
146
147
function qsEscape ( str ) {
0 commit comments