path-parser
Advanced tools
Comparing version 0.4.3 to 0.4.4
@@ -0,1 +1,11 @@ | ||
<a name="0.4.4"></a> | ||
## 0.4.4 (2015-11-24) | ||
### Bug Fixes | ||
* encode and decode query parameters special characters ([5c69712](https://github.com/troch/path-parser/commit/5c69712)) | ||
<a name="0.4.3"></a> | ||
@@ -2,0 +12,0 @@ ## 0.4.3 (2015-10-11) |
@@ -108,3 +108,3 @@ define(['exports', 'module'], function (exports, module) { | ||
}).reduce(function (obj, m) { | ||
return appendQueryParam(obj, m[0], m[1]); | ||
return appendQueryParam(obj, m[0], m[1] ? decodeURIComponent(m[1]) : m[1]); | ||
}, {}); | ||
@@ -114,3 +114,3 @@ }; | ||
var toSerialisable = function toSerialisable(val) { | ||
return val !== undefined && val !== null && val !== '' ? '=' + val : ''; | ||
return val !== undefined && val !== null && val !== '' ? '=' + encodeURIComponent(val) : ''; | ||
}; | ||
@@ -117,0 +117,0 @@ |
@@ -111,3 +111,3 @@ 'use strict'; | ||
}).reduce(function (obj, m) { | ||
return appendQueryParam(obj, m[0], m[1]); | ||
return appendQueryParam(obj, m[0], m[1] ? decodeURIComponent(m[1]) : m[1]); | ||
}, {}); | ||
@@ -117,3 +117,3 @@ }; | ||
var toSerialisable = function toSerialisable(val) { | ||
return val !== undefined && val !== null && val !== '' ? '=' + val : ''; | ||
return val !== undefined && val !== null && val !== '' ? '=' + encodeURIComponent(val) : ''; | ||
}; | ||
@@ -120,0 +120,0 @@ |
@@ -120,3 +120,3 @@ (function (global, factory) { | ||
}).reduce(function (obj, m) { | ||
return appendQueryParam(obj, m[0], m[1]); | ||
return appendQueryParam(obj, m[0], m[1] ? decodeURIComponent(m[1]) : m[1]); | ||
}, {}); | ||
@@ -126,3 +126,3 @@ }; | ||
var toSerialisable = function toSerialisable(val) { | ||
return val !== undefined && val !== null && val !== '' ? '=' + val : ''; | ||
return val !== undefined && val !== null && val !== '' ? '=' + encodeURIComponent(val) : ''; | ||
}; | ||
@@ -129,0 +129,0 @@ |
@@ -96,6 +96,6 @@ let defaultOrConstrained = (match) => { | ||
.map(_ => _.split('=')) | ||
.reduce((obj, m) => appendQueryParam(obj, m[0], m[1]), {}) | ||
.reduce((obj, m) => appendQueryParam(obj, m[0], m[1] ? decodeURIComponent(m[1]) : m[1]), {}) | ||
} | ||
let toSerialisable = val => val !== undefined && val !== null && val !== '' ? '=' + val : '' | ||
let toSerialisable = val => val !== undefined && val !== null && val !== '' ? '=' + encodeURIComponent(val) : '' | ||
@@ -102,0 +102,0 @@ let serialise = (key, val) => Array.isArray(val) ? val.map(v => serialise(key, v)).join('&') : key + toSerialisable(val) |
{ | ||
"name": "path-parser", | ||
"version": "0.4.3", | ||
"version": "0.4.4", | ||
"description": "A small utility to parse, match and generate paths", | ||
@@ -5,0 +5,0 @@ "main": "dist/commonjs/path-parser.js", |
@@ -57,3 +57,3 @@ 'use strict'; | ||
path.partialMatch('/users?offset&limits=1').should.eql({ offset: '' }); | ||
path.partialMatch('/users?offset=1&offset=2&limits=1').should.eql({ offset: ['1', '2'] }); | ||
path.partialMatch('/users?offset=1&offset=2%202&limits=1').should.eql({ offset: ['1', '2 2'] }); | ||
path.partialMatch('/users').should.eql({}); | ||
@@ -65,3 +65,3 @@ | ||
path.build({ offset: 31, limit: 15 }).should.equal('/users?offset=31&limit=15'); | ||
path.build({ offset: 31, limit: '15 15' }).should.equal('/users?offset=31&limit=15%2015'); | ||
path.build({ offset: 31 }).should.equal('/users?offset=31'); | ||
@@ -68,0 +68,0 @@ path.build({ offset: 31, limit: '' }).should.equal('/users?offset=31&limit'); |
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
68134