Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

query-string

Package Overview
Dependencies
Maintainers
1
Versions
82
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

query-string - npm Package Compare versions

Comparing version 4.0.2 to 4.1.0

16

index.js
'use strict';
var strictUriEncode = require('strict-uri-encode');
function encode(value, strict) {
return strict ? strictUriEncode(value) : encodeURIComponent(value);
}
exports.extract = function (str) {

@@ -48,3 +52,7 @@ return str.split('?')[1] || '';

exports.stringify = function (obj) {
exports.stringify = function (obj, opts) {
opts = opts || {};
var strict = opts.strict !== false;
return obj ? Object.keys(obj).sort().map(function (key) {

@@ -70,5 +78,5 @@ var val = obj[key];

if (val2 === null) {
result.push(strictUriEncode(key));
result.push(encode(key, strict));
} else {
result.push(strictUriEncode(key) + '=' + strictUriEncode(val2));
result.push(encode(key, strict) + '=' + encode(val2, strict));
}

@@ -80,3 +88,3 @@ });

return strictUriEncode(key) + '=' + strictUriEncode(val);
return encode(key, strict) + '=' + encode(val, strict);
}).filter(function (x) {

@@ -83,0 +91,0 @@ return x.length > 0;

{
"name": "query-string",
"version": "4.0.2",
"version": "4.1.0",
"description": "Parse and stringify URL query strings",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -50,6 +50,14 @@ # query-string [![Build Status](https://travis-ci.org/sindresorhus/query-string.svg?branch=master)](https://travis-ci.org/sindresorhus/query-string)

### .stringify(*object*)
### .stringify(*object*, *[options]*)
Stringify an object into a query string, sorting the keys.
#### strict
Type: `boolean`<br />
Default: `true`
Strictly encode URI components with [strict-uri-encode](https://github.com/kevva/strict-uri-encode). It uses [encodeURIComponent](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent)
if set to false. You probably [don't care](https://github.com/sindresorhus/query-string/issues/42) about this option.
### .extract(*string*)

@@ -56,0 +64,0 @@

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