url-search-params-polyfill
Advanced tools
Comparing version 6.0.0 to 7.0.0
23
index.js
@@ -276,6 +276,19 @@ /** | ||
if (typeof search === "object") { | ||
for (var key in search) { | ||
if (search.hasOwnProperty(key)) { | ||
appendTo(dict, key, search[key]) | ||
// if `search` is an array, treat it as a sequence | ||
if (isArray(search)) { | ||
for (var i = 0; i < search.length; i++) { | ||
var item = search[i]; | ||
if (isArray(item) && item.length === 2) { | ||
appendTo(dict, item[0], item[1]); | ||
} else { | ||
throw new TypeError("Failed to construct 'URLSearchParams': Sequence initializer must only contain pair elements"); | ||
} | ||
} | ||
} else { | ||
for (var key in search) { | ||
if (search.hasOwnProperty(key)) { | ||
appendTo(dict, key, search[key]); | ||
} | ||
} | ||
} | ||
@@ -320,2 +333,6 @@ | ||
function isArray(val) { | ||
return !!val && '[object Array]' === Object.prototype.toString.call(val); | ||
} | ||
})(typeof global !== 'undefined' ? global : (typeof window !== 'undefined' ? window : this)); |
{ | ||
"name": "url-search-params-polyfill", | ||
"version": "6.0.0", | ||
"version": "7.0.0", | ||
"description": "a simple polyfill for javascript URLSearchParams", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/jerrybendy/url-search-params-polyfill", |
@@ -60,2 +60,5 @@ # URLSearchParams Polyfill [![](https://img.shields.io/npm/v/url-search-params-polyfill.svg)](https://www.npmjs.com/package/url-search-params-polyfill) | ||
var search5 = new URLSearchParams(search2); | ||
// from a sequence | ||
var search6 = new URLSearchParams([["foo", 1], ["bar", 2]]); | ||
``` | ||
@@ -62,0 +65,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
15503
293
181