query-string
Advanced tools
Comparing version 2.3.0 to 2.4.0
10
index.js
'use strict'; | ||
var strictUriEncode = require('strict-uri-encode'); | ||
exports.extract = function (maybeUrl) { | ||
return maybeUrl.split('?')[1] || ''; | ||
exports.extract = function (str) { | ||
return str.split('?')[1] || ''; | ||
}; | ||
@@ -24,2 +25,3 @@ | ||
key = decodeURIComponent(key); | ||
// missing `=` should be `null`: | ||
@@ -47,8 +49,8 @@ // http://w3.org/TR/2012/WD-url-20120524/#collect-url-parameters | ||
return val.sort().map(function (val2) { | ||
return encodeURIComponent(key) + '=' + encodeURIComponent(val2); | ||
return strictUriEncode(key) + '=' + strictUriEncode(val2); | ||
}).join('&'); | ||
} | ||
return encodeURIComponent(key) + '=' + encodeURIComponent(val); | ||
return strictUriEncode(key) + '=' + strictUriEncode(val); | ||
}).join('&') : ''; | ||
}; |
{ | ||
"name": "query-string", | ||
"version": "2.3.0", | ||
"version": "2.4.0", | ||
"description": "Parse and stringify URL query strings", | ||
"license": "MIT", | ||
"repository": "sindresorhus/query-string", | ||
"author": { | ||
"name": "Sindre Sorhus", | ||
"email": "sindresorhus@gmail.com", | ||
"url": "sindresorhus.com" | ||
}, | ||
"engines": { | ||
"node": ">=0.10.0" | ||
}, | ||
"scripts": { | ||
"test": "mocha" | ||
}, | ||
"files": [ | ||
"index.js" | ||
], | ||
"keywords": [ | ||
@@ -20,21 +36,8 @@ "browser", | ||
], | ||
"license": "MIT", | ||
"author": { | ||
"name": "Sindre Sorhus", | ||
"email": "sindresorhus@gmail.com", | ||
"url": "sindresorhus.com" | ||
"dependencies": { | ||
"strict-uri-encode": "^1.0.0" | ||
}, | ||
"files": [ | ||
"index.js" | ||
], | ||
"repository": "sindresorhus/query-string", | ||
"scripts": { | ||
"test": "mocha" | ||
}, | ||
"devDependencies": { | ||
"mocha": "*" | ||
}, | ||
"engines": { | ||
"node": ">=0.10.0" | ||
} | ||
} |
@@ -19,3 +19,3 @@ # query-string [![Build Status](https://travis-ci.org/sindresorhus/query-string.svg?branch=master)](https://travis-ci.org/sindresorhus/query-string) | ||
console.log(location.search); | ||
//=> ?foo=bar | ||
//=> '?foo=bar' | ||
@@ -27,3 +27,3 @@ var parsed = queryString.parse(location.search); | ||
console.log(location.hash); | ||
//=> #token=bada55cafe | ||
//=> '#token=bada55cafe' | ||
@@ -40,3 +40,3 @@ var parsedHash = queryString.parse(location.hash); | ||
console.log(location.search); | ||
//=> ?foo=unicorn&ilike=pizza | ||
//=> '?foo=unicorn&ilike=pizza' | ||
``` | ||
@@ -62,3 +62,3 @@ | ||
This module intentionally doesn't support nesting as it's not specced and varies between implementations, which causes a lot of [edge cases](https://github.com/visionmedia/node-querystring/issues). | ||
This module intentionally doesn't support nesting as it's not spec'd and varies between implementations, which causes a lot of [edge cases](https://github.com/visionmedia/node-querystring/issues). | ||
@@ -74,3 +74,3 @@ You're much better off just converting the object to a JSON string: | ||
}); | ||
//=> foo=bar&nested=%7B%22unicorn%22%3A%22cake%22%7D | ||
//=> 'foo=bar&nested=%7B%22unicorn%22%3A%22cake%22%7D' | ||
``` | ||
@@ -77,0 +77,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
4677
42
1
+ Addedstrict-uri-encode@^1.0.0
+ Addedstrict-uri-encode@1.1.0(transitive)