urlencode-for-php
Advanced tools
Comparing version 1.0.3 to 1.0.4
@@ -11,3 +11,4 @@ module.exports = encode; | ||
{ | ||
if (typeof flatted[key] === 'object' && Object.keys(flatted[key]).length === 0) continue; | ||
if (flatted[key] !== null && typeof flatted[key] === 'object' && Object.keys(flatted[key]).length === 0) continue; | ||
if (flatted[key] === null) continue; | ||
params.push( dot2brackets(key)+'='+encodeURIComponent(flatted[key]) ); | ||
@@ -14,0 +15,0 @@ } |
{ | ||
"name": "urlencode-for-php", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "encode object/array to php-like query string", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -1,7 +0,6 @@ | ||
var urlencode = require('../'); | ||
const urlencode = require('../'); | ||
describe('urlencode-for-php', function() | ||
{ | ||
it('test1', function(done) | ||
{ | ||
describe('urlencode-for-php', function() { | ||
it('test1', function(done) { | ||
var obj = {a:[1,2,3,4]}; | ||
@@ -13,4 +12,10 @@ var expected = 'a[0]=1&a[1]=2&a[2]=3&a[3]=4'; | ||
it('test2', function(done) | ||
{ | ||
it('test11', function(done) { | ||
var obj = {a:[1,2,3,4], b:{}, c: [], d: null}; | ||
var expected = 'a[0]=1&a[1]=2&a[2]=3&a[3]=4'; | ||
console.log(urlencode(obj)); | ||
done(); | ||
}); | ||
it('test2', function(done) { | ||
var obj = | ||
@@ -31,4 +36,3 @@ { | ||
it('test3', function(done) | ||
{ | ||
it('test3', function(done) { | ||
var obj = | ||
@@ -35,0 +39,0 @@ { |
3878
66