[Robustness] stringify: avoid relying on a global undefined#427
[Robustness] stringify: avoid relying on a global undefined#427ljharb merged 1 commit intoljharb:masterfrom
stringify: avoid relying on a global undefined#427Conversation
ljharb
left a comment
There was a problem hiding this comment.
These are not needless at all. undefined can be redefined in every scope except the global scope in ES5, and in ES3 - which this package supports - it can be modified in the global scope otherwise.
Yes, but there are many places with same check. For example https://github.com/ljharb/qs/blob/master/lib/stringify.js#L155 or https://github.com/ljharb/qs/blob/master/lib/stringify.js#L195 |
|
In that case, those should be changed to use typeof instead :-) want to update the PR to do that? |
|
@ljharb |
852cab8 to
de140f3
Compare
|
@ljharb updated. |
|
Definitely the |
stringify: avoid relying on a global undefined
5c1223e to
0a1d3e8
Compare
Codecov Report
@@ Coverage Diff @@
## master #427 +/- ##
=======================================
Coverage 99.85% 99.85%
=======================================
Files 8 8
Lines 1408 1408
Branches 172 172
=======================================
Hits 1406 1406
Misses 2 2
Continue to review full report at Codecov.
|
I just removed needless(for these cases)
typeoffor checking for undefinedupdate: Added checking for typeof in parser.