Skip to content

Commit

Permalink
Fix issue in RN #41
Browse files Browse the repository at this point in the history
  • Loading branch information
jerrybendy committed Apr 24, 2020
1 parent 7943dc3 commit fc69a9e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,15 @@
(function(self) {
'use strict';

var nativeURLSearchParams = (self.URLSearchParams && self.URLSearchParams.prototype.get) ? self.URLSearchParams : null,
var nativeURLSearchParams = (function() {
// #41 Fix issue in RN
try {
if (self.URLSearchParams && (new self.URLSearchParams('foo=bar')).get('foo') === 'bar') {
return self.URLSearchParams;
}
} catch (e) {}
return null;
})(),
isSupportObjectConstructor = nativeURLSearchParams && (new nativeURLSearchParams({a: 1})).toString() === 'a=1',
// There is a bug in safari 10.1 (and earlier) that incorrectly decodes `%2B` as an empty space and not a plus.
decodesPlusesCorrectly = nativeURLSearchParams && (new nativeURLSearchParams('s=%2B').get('s') === '+'),
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "url-search-params-polyfill",
"version": "8.0.0",
"version": "8.1.0",
"description": "a simple polyfill for javascript URLSearchParams",
"homepage": "https://github.com/jerrybendy/url-search-params-polyfill",
"main": "index.js",
Expand Down

0 comments on commit fc69a9e

Please sign in to comment.