route-node
Advanced tools
Comparing version 2.0.2 to 2.0.3
@@ -0,1 +1,8 @@ | ||
<a name="2.0.3"></a> | ||
## [2.0.3](https://github.com/troch/route-node/compare/v2.0.2...v2.0.3) (2018-03-05) | ||
* Ensure that order of routes that cannot be disambiguated is preserved ([6b58877](https://github.com/troch/route-node/commit/6b58877)) | ||
<a name="2.0.2"></a> | ||
@@ -2,0 +9,0 @@ ## [2.0.2](https://github.com/troch/route-node/compare/v2.0.1...v2.0.2) (2017-11-16) |
@@ -618,2 +618,5 @@ 'use strict'; | ||
// Push greedy spats to the bottom of the pile | ||
var originalChildren = this.children.slice(0); | ||
this.children.sort(function (left, right) { | ||
@@ -643,4 +646,5 @@ var leftPath = left.path.replace(/<.*?>/g, '').split('?')[0].replace(/(.+)\/$/, '$1'); | ||
if (leftParamLength > rightParamLength) return -1; | ||
// Same last segment length, preserve definition order | ||
return 0; | ||
// Same last segment length, preserve definition order. Note that we | ||
// cannot just return 0, as sort is not guaranteed to be a stable sort. | ||
return originalChildren.indexOf(left) - originalChildren.indexOf(right); | ||
}); | ||
@@ -647,0 +651,0 @@ } else { |
@@ -616,2 +616,5 @@ // Split path | ||
// Push greedy spats to the bottom of the pile | ||
var originalChildren = this.children.slice(0); | ||
this.children.sort(function (left, right) { | ||
@@ -641,4 +644,5 @@ var leftPath = left.path.replace(/<.*?>/g, '').split('?')[0].replace(/(.+)\/$/, '$1'); | ||
if (leftParamLength > rightParamLength) return -1; | ||
// Same last segment length, preserve definition order | ||
return 0; | ||
// Same last segment length, preserve definition order. Note that we | ||
// cannot just return 0, as sort is not guaranteed to be a stable sort. | ||
return originalChildren.indexOf(left) - originalChildren.indexOf(right); | ||
}); | ||
@@ -645,0 +649,0 @@ } else { |
@@ -622,2 +622,5 @@ (function (global, factory) { | ||
// Push greedy spats to the bottom of the pile | ||
var originalChildren = this.children.slice(0); | ||
this.children.sort(function (left, right) { | ||
@@ -647,4 +650,5 @@ var leftPath = left.path.replace(/<.*?>/g, '').split('?')[0].replace(/(.+)\/$/, '$1'); | ||
if (leftParamLength > rightParamLength) return -1; | ||
// Same last segment length, preserve definition order | ||
return 0; | ||
// Same last segment length, preserve definition order. Note that we | ||
// cannot just return 0, as sort is not guaranteed to be a stable sort. | ||
return originalChildren.indexOf(left) - originalChildren.indexOf(right); | ||
}); | ||
@@ -651,0 +655,0 @@ } else { |
@@ -111,2 +111,5 @@ import Path from 'path-parser'; | ||
// Push greedy spats to the bottom of the pile | ||
const originalChildren = this.children.slice(0); | ||
this.children.sort((left, right) => { | ||
@@ -142,4 +145,5 @@ const leftPath = left.path | ||
if (leftParamLength > rightParamLength) return -1; | ||
// Same last segment length, preserve definition order | ||
return 0; | ||
// Same last segment length, preserve definition order. Note that we | ||
// cannot just return 0, as sort is not guaranteed to be a stable sort. | ||
return originalChildren.indexOf(left) - originalChildren.indexOf(right); | ||
}); | ||
@@ -146,0 +150,0 @@ } else { |
{ | ||
"name": "route-node", | ||
"version": "2.0.2", | ||
"version": "2.0.3", | ||
"description": "A package to create a tree of named routes", | ||
@@ -5,0 +5,0 @@ "main": "dist/cjs/route-node.js", |
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
274278
2889