Socket
Socket
Sign inDemoInstall

form-urlencoded

Package Overview
Dependencies
Maintainers
1
Versions
80
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

form-urlencoded - npm Package Compare versions

Comparing version 1.1.4 to 1.1.5

32

form-urlencoded.js
// Filename: formurlencoded.js
// Timestamp: 2016.01.10-10:46:11 (last modified)
// Timestamp: 2016.01.17-14:31:12 (last modified)
// Author(s): Bumblehead (www.bumblehead.com), JBlashill (james@blashill.com)

@@ -20,3 +20,3 @@ //

function getKeys (obj) {
function keys (obj) {
var keys = Object.keys(obj);

@@ -27,21 +27,19 @@

function joinFilter (arr) {
return arr.filter(function (e) {
return typeof e === 'string' && e.length;
}).join('&');
function filterjoin (arr) {
return arr.filter(function (e) { return e; }).join('&');
}
function getObjNestVals (name, obj) {
return joinFilter(getKeys(obj).map(function (key) {
return getNestVals(name + '[' + key + ']', obj[key]);
function objnest (name, obj) {
return filterjoin(keys(obj).map(function (key) {
return nest(name + '[' + key + ']', obj[key]);
}));
}
function getArrNestVals (name, arr) {
return joinFilter(arr.map(function (elem) {
return getNestVals(name + '[]', elem);
function arrnest (name, arr) {
return filterjoin(arr.map(function (elem) {
return nest(name + '[]', elem);
}));
}
function getNestVals (name, value) {
function nest (name, value) {
var type = typeof value,

@@ -55,5 +53,5 @@ f = null;

} else if (Array.isArray(value)) {
f = getArrNestVals(name, value);
f = arrnest(name, value);
} else if (type === 'object') {
f = getObjNestVals(name, value);
f = objnest(name, value);
}

@@ -64,5 +62,5 @@

return joinFilter(getKeys(data).map(function (key) {
return getNestVals(encode(key), data[key]);
return filterjoin(keys(data).map(function (key) {
return nest(encode(key), data[key]);
}));
};
{
"name": "form-urlencoded",
"main": "form-urlencoded",
"version": "1.1.4",
"version": "1.1.5",
"description": "Return an object as an `x-www-form-urlencoded` string",

@@ -6,0 +6,0 @@ "author": "Chris <chris@bumblehead.com>",

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