Skip to content

Commit

Permalink
fixed a bug
Browse files Browse the repository at this point in the history
  • Loading branch information
calidion committed Mar 15, 2016
1 parent df9f477 commit b761165
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/index.js
Expand Up @@ -22,7 +22,7 @@ module.exports = {
params = params || {};
var keys = [];
for (var k in params) {
if (typeof params[k] === 'string') {
if (['string', 'number'].indexOf(typeof params[k]) !== -1) {
keys.push(encodeURIComponent(k) + '=' + encodeURIComponent(params[k]));
}
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "node-weixin-util",
"version": "0.3.0",
"version": "0.3.1",
"description": "",
"homepage": "",
"author": {
Expand Down
5 changes: 4 additions & 1 deletion test/index.js
Expand Up @@ -15,11 +15,14 @@ describe('node-weixin-util node module', function () {
var params = {
a: '1',
c: '2',
d: 3,
e: 3.1,
'd-c': 'aaa'
};

var url = nodeWeixinUtil.toParam(params);
assert.equal(true, url === 'a=1&c=2&d-c=aaa');
console.log(url);
assert.equal(true, url === 'a=1&c=2&d=3&e=3.1&d-c=aaa');
params = {
a: '1',
c: '2',
Expand Down

0 comments on commit b761165

Please sign in to comment.