url-search-params-polyfill
Advanced tools
Comparing version 5.0.0 to 5.0.1
21
index.js
@@ -12,3 +12,3 @@ /** | ||
var nativeURLSearchParams = self.URLSearchParams ? self.URLSearchParams : null, | ||
var nativeURLSearchParams = (self.URLSearchParams && self.URLSearchParams.prototype.get) ? self.URLSearchParams : null, | ||
isSupportObjectConstructor = nativeURLSearchParams && (new nativeURLSearchParams({a: 1})).toString() === 'a=1', | ||
@@ -135,12 +135,13 @@ // There is a bug in safari 10.1 (and earlier) that incorrectly decodes `%2B` as an empty space and not a plus. | ||
*/ | ||
self.URLSearchParams = useProxy ? | ||
// Safari 10.0 doesn't support Proxy, so it won't extend URLSearchParams on safari 10.0 | ||
new Proxy(nativeURLSearchParams, { | ||
construct: function(target, args) { | ||
return new target((new URLSearchParamsPolyfill(args[0]).toString())); | ||
} | ||
}) : | ||
URLSearchParamsPolyfill; | ||
Object.defineProperty(self, 'URLSearchParams', { | ||
value: (useProxy ? | ||
// Safari 10.0 doesn't support Proxy, so it won't extend URLSearchParams on safari 10.0 | ||
new Proxy(nativeURLSearchParams, { | ||
construct: function(target, args) { | ||
return new target((new URLSearchParamsPolyfill(args[0]).toString())); | ||
} | ||
}) : | ||
URLSearchParamsPolyfill) | ||
}); | ||
var USPProto = self.URLSearchParams.prototype; | ||
@@ -147,0 +148,0 @@ |
{ | ||
"name": "url-search-params-polyfill", | ||
"version": "5.0.0", | ||
"version": "5.0.1", | ||
"description": "a simple polyfill for javascript URLSearchParams", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/jerrybendy/url-search-params-polyfill", |
# URLSearchParams Polyfill [![](https://img.shields.io/npm/v/url-search-params-polyfill.svg)](https://www.npmjs.com/package/url-search-params-polyfill) | ||
This is a polyfill library for JavaScript's URLSearchParams class. This library has implemented all features from [MDN document](https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams). | ||
This is a polyfill library for JavaScript's `URLSearchParams` class. | ||
This library can use for both browsers and Node.js. | ||
### Features | ||
Some browsers have native URLSearchParams class support, but not full. The new `2.x` version detects if browsers have full feature support and extends it. | ||
* Implemented all features from [MDN document](https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams). | ||
* Can use for both browsers and Node.js. | ||
* Detect if browsers have full support for `URLSearchParams` and extend it | ||
## Installation | ||
@@ -10,0 +13,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
32647
8
648
177