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