Socket
Socket
Sign inDemoInstall

url-search-params-polyfill

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

url-search-params-polyfill - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

.idea/jsLibraryMappings.xml

6

index.js
/**
* Created by jerry on 16/9/2.
*
*
* @author Jerry Bendy <jerry@icewingcc.com>
* @licence MIT
*
*/

@@ -4,0 +8,0 @@

2

package.json
{
"name": "url-search-params-polyfill",
"version": "1.0.0",
"version": "1.0.1",
"description": "a simple polyfill for javascript URLSearchParams",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/jerrybendy/url-search-params-polyfill",

@@ -1,2 +0,95 @@

# url-search-params-polyfill
# URLSearchParams polyfill
This is a simple polyfill library for javascript's URLSearchParams class.
## Installation
This can also be installed with `npm`.
```sh
$ npm install url-search-params-polyfill --save
```
For babel and es2015+, make sure to import the file:
```javascript
import 'url-search-params-polyfill';
```
## Usage
Use `URLSearchParams` directly. You can `new` an object from a string or an object.
```javascript
// new a empty object
var search1 = new URLSearchParams ();
// from a string
var search2 = new URLSearchParams ("id=1&from=home");
// from an object
var search3 = new URLSearchParams ({id: 1, from: "home"});
// from location.search, will remove first "?" automatically
var search4 = new URLSearchParams (window.location.search);
```
### append
```javascript
var search = new URLSearchParams ();
search.append("id", 1);
```
### delete
```javascript
search.delete("id");
```
### get
```javascript
search.get("id");
```
### getAll
```javascript
search.getAll("id");
```
### has
```javascript
search.has("id");
```
### set
```javascript
search.set("id", 2);
```
### toString
```javascript
search.toString();
```
### forEach
```javascript
search.forEach(function (item) {
console.log(item);
});
```
## LICENSE
MIT license

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc