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

path-parser

Package Overview
Dependencies
Maintainers
1
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

path-parser - npm Package Compare versions

Comparing version 0.3.0 to 0.3.1

141

CHANGELOG.md

@@ -0,1 +1,11 @@

<a name="0.3.1"></a>
## 0.3.1 (2015-09-04)
### Bug Fixes
* better building and matching of query params ([5e8f881](https://github.com/troch/path-parser/commit/5e8f881))
<a name="0.3.0"></a>

@@ -175,1 +185,132 @@ # 0.3.0 (2015-09-03)

<a name="0.2.4"></a>
## 0.2.4 (2015-09-01)
### Features
* allow optional trailing slash for '/' ([570a0c4](https://github.com/troch/path-parser/commit/570a0c4))
<a name="0.2.3"></a>
## 0.2.3 (2015-08-20)
### Bug Fixes
* better escape regular expression special chars so built source matches regexp so ([21d30b7](https://github.com/troch/path-parser/commit/21d30b7))
<a name="0.2.2"></a>
## 0.2.2 (2015-08-19)
### Bug Fixes
* escape special characters properly in regular expressions ([f573957](https://github.com/troch/path-parser/commit/f573957))
<a name="0.2.1"></a>
## 0.2.1 (2015-08-19)
### Bug Fixes
* don't apply optional trailing slashes on paths === / ([36e0180](https://github.com/troch/path-parser/commit/36e0180))
<a name="0.2.0"></a>
# 0.2.0 (2015-08-19)
### Features
* support optional trailing slashes ([6785886](https://github.com/troch/path-parser/commit/6785886))
<a name="0.1.1"></a>
## 0.1.1 (2015-07-22)
<a name="0.1.0"></a>
# 0.1.0 (2015-07-06)
### Features
* add matrix and url parameter constraints ([a567ba1](https://github.com/troch/path-parser/commit/a567ba1))
<a name="0.0.7"></a>
## 0.0.7 (2015-07-01)
### Features
* support matrix parameters ([0451290](https://github.com/troch/path-parser/commit/0451290))
<a name="0.0.6"></a>
## 0.0.6 (2015-06-30)
<a name="0.0.5"></a>
## 0.0.5 (2015-06-30)
<a name="0.0.4"></a>
## 0.0.4 (2015-06-28)
### Bug Fixes
* fix bug when multiple query params ([880bae0](https://github.com/troch/path-parser/commit/880bae0))
### Features
* improve tokenisation and tests ([5b9e1fe](https://github.com/troch/path-parser/commit/5b9e1fe))
<a name="0.0.3"></a>
## 0.0.3 (2015-06-26)
### Bug Fixes
* fix path building with splats ([7bd7d74](https://github.com/troch/path-parser/commit/7bd7d74))
<a name="0.0.2"></a>
## 0.0.2 (2015-06-25)
### Features
* add splat support with query params ([96bcd6d](https://github.com/troch/path-parser/commit/96bcd6d))
<a name="0.0.1"></a>
## 0.0.1 (2015-06-25)
### Features
* add spat param flag ([b77174a](https://github.com/troch/path-parser/commit/b77174a))
* add support for query parameters ([4ee86cf](https://github.com/troch/path-parser/commit/4ee86cf))
* add support for splats ([e346bbf](https://github.com/troch/path-parser/commit/e346bbf))

8

dist/amd/path-parser.js

@@ -92,2 +92,6 @@ define(['exports', 'module'], function (exports, module) {

var isSerialisable = function isSerialisable(val) {
return val !== undefined && val !== null && val !== '';
};
var Path = (function () {

@@ -177,3 +181,3 @@ function Path(path) {

}).reduce(function (obj, m) {
obj[m[0]] = m[1];
obj[m[0]] = m[1] === undefined ? '' : m[1];
return obj;

@@ -241,3 +245,3 @@ }, {});

}).map(function (p) {
return p + '=' + params[p];
return p + (isSerialisable(params[p]) ? '=' + params[p] : '');
}).join('&');

@@ -244,0 +248,0 @@

@@ -95,2 +95,6 @@ 'use strict';

var isSerialisable = function isSerialisable(val) {
return val !== undefined && val !== null && val !== '';
};
var Path = (function () {

@@ -180,3 +184,3 @@ function Path(path) {

}).reduce(function (obj, m) {
obj[m[0]] = m[1];
obj[m[0]] = m[1] === undefined ? '' : m[1];
return obj;

@@ -244,3 +248,3 @@ }, {});

}).map(function (p) {
return p + '=' + params[p];
return p + (isSerialisable(params[p]) ? '=' + params[p] : '');
}).join('&');

@@ -247,0 +251,0 @@

@@ -104,2 +104,6 @@ (function (global, factory) {

var isSerialisable = function isSerialisable(val) {
return val !== undefined && val !== null && val !== '';
};
var Path = (function () {

@@ -189,3 +193,3 @@ function Path(path) {

}).reduce(function (obj, m) {
obj[m[0]] = m[1];
obj[m[0]] = m[1] === undefined ? '' : m[1];
return obj;

@@ -253,3 +257,3 @@ }, {});

}).map(function (p) {
return p + '=' + params[p];
return p + (isSerialisable(params[p]) ? '=' + params[p] : '');
}).join('&');

@@ -256,0 +260,0 @@

@@ -82,2 +82,4 @@ let defaultOrConstrained = (match) => {

let isSerialisable = val => val !== undefined && val !== null && val !== ''
export default class Path {

@@ -137,3 +139,3 @@ constructor(path) {

.reduce((obj, m) => {
obj[m[0]] = m[1]
obj[m[0]] = m[1] === undefined ? '' : m[1]
return obj

@@ -186,3 +188,3 @@ }, {})

.filter(p => Object.keys(params).indexOf(p) !== -1)
.map(p => p + '=' + params[p])
.map(p => p + (isSerialisable(params[p]) ? '=' + params[p] : ''))
.join('&')

@@ -189,0 +191,0 @@

{
"name": "path-parser",
"version": "0.3.0",
"version": "0.3.1",
"description": "A small utility to parse, match and generate paths",

@@ -5,0 +5,0 @@ "main": "dist/commonjs/path-parser.js",

@@ -49,2 +49,3 @@ 'use strict';

path.match('/users?offset=31&limit=15').should.eql({ offset: '31', limit: '15' });
path.match('/users?offset&limit=15').should.eql({ offset: '', limit: '15' });
// path.partialMatch('/users').should.eql({});

@@ -57,3 +58,7 @@ // Unsuccessful match

path.build({ offset: 31 }).should.equal('/users?offset=31');
path.build({ offset: 31, limit: '' }).should.equal('/users?offset=31&limit');
path.build({ offset: 31, limit: undefined }).should.equal('/users?offset=31&limit');
path.build({ offset: 31, limit: false }).should.equal('/users?offset=31&limit=false');
path.build({ offset: 31, limit: 15 }, {ignoreSearch: true}).should.equal('/users');
});

@@ -60,0 +65,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