url-search-params-polyfill
Advanced tools
Comparing version 1.0.0 to 1.0.1
/** | ||
* Created by jerry on 16/9/2. | ||
* | ||
* | ||
* @author Jerry Bendy <jerry@icewingcc.com> | ||
* @licence MIT | ||
* | ||
*/ | ||
@@ -4,0 +8,0 @@ |
{ | ||
"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
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
16
109
96
27081