route-node
Advanced tools
Comparing version 3.0.3 to 3.1.0
@@ -0,1 +1,11 @@ | ||
<a name="3.1.0"></a> | ||
# [3.1.0](https://github.com/troch/route-node/compare/v3.0.3...v3.1.0) (2018-04-19) | ||
### Features | ||
* expose caseSensitive option from path-parser ([ff3fcb8](https://github.com/troch/route-node/commit/ff3fcb8)) | ||
<a name="3.0.3"></a> | ||
@@ -2,0 +12,0 @@ ## [3.0.3](https://github.com/troch/route-node/compare/v3.0.2...v3.0.3) (2018-04-09) |
@@ -120,3 +120,3 @@ 'use strict'; | ||
if (options === void 0) { options = {}; } | ||
var _a = options.queryParamsMode, queryParamsMode = _a === void 0 ? 'default' : _a, _b = options.strictTrailingSlash, strictTrailingSlash = _b === void 0 ? false : _b, _c = options.strongMatching, strongMatching = _c === void 0 ? true : _c; | ||
var _a = options.queryParamsMode, queryParamsMode = _a === void 0 ? 'default' : _a, _b = options.strictTrailingSlash, strictTrailingSlash = _b === void 0 ? false : _b, _c = options.strongMatching, strongMatching = _c === void 0 ? true : _c, _d = options.caseSensitive, caseSensitive = _d === void 0 ? false : _d; | ||
var isRoot = nodes.length === 1 && nodes[0].name === ''; | ||
@@ -134,7 +134,11 @@ var _loop_1 = function (child) { | ||
if (!child.children.length) { | ||
match = child.parser.test(segment, options); | ||
match = child.parser.test(segment, { | ||
caseSensitive: caseSensitive, | ||
strictTrailingSlash: strictTrailingSlash | ||
}); | ||
} | ||
if (!match) { | ||
match = child.parser.partialTest(segment, { | ||
delimited: strongMatching | ||
delimited: strongMatching, | ||
caseSensitive: caseSensitive | ||
}); | ||
@@ -150,3 +154,3 @@ } | ||
} | ||
remainingPath = segment.replace(consumedPath, ''); | ||
remainingPath = segment.replace(new RegExp('^' + consumedPath, 'i'), ''); | ||
if (!strictTrailingSlash && !child.children.length) { | ||
@@ -153,0 +157,0 @@ remainingPath = remainingPath.replace(/^\/\?/, '?'); |
@@ -118,3 +118,3 @@ import { build, omit, parse } from 'search-params'; | ||
if (options === void 0) { options = {}; } | ||
var _a = options.queryParamsMode, queryParamsMode = _a === void 0 ? 'default' : _a, _b = options.strictTrailingSlash, strictTrailingSlash = _b === void 0 ? false : _b, _c = options.strongMatching, strongMatching = _c === void 0 ? true : _c; | ||
var _a = options.queryParamsMode, queryParamsMode = _a === void 0 ? 'default' : _a, _b = options.strictTrailingSlash, strictTrailingSlash = _b === void 0 ? false : _b, _c = options.strongMatching, strongMatching = _c === void 0 ? true : _c, _d = options.caseSensitive, caseSensitive = _d === void 0 ? false : _d; | ||
var isRoot = nodes.length === 1 && nodes[0].name === ''; | ||
@@ -132,7 +132,11 @@ var _loop_1 = function (child) { | ||
if (!child.children.length) { | ||
match = child.parser.test(segment, options); | ||
match = child.parser.test(segment, { | ||
caseSensitive: caseSensitive, | ||
strictTrailingSlash: strictTrailingSlash | ||
}); | ||
} | ||
if (!match) { | ||
match = child.parser.partialTest(segment, { | ||
delimited: strongMatching | ||
delimited: strongMatching, | ||
caseSensitive: caseSensitive | ||
}); | ||
@@ -148,3 +152,3 @@ } | ||
} | ||
remainingPath = segment.replace(consumedPath, ''); | ||
remainingPath = segment.replace(new RegExp('^' + consumedPath, 'i'), ''); | ||
if (!strictTrailingSlash && !child.children.length) { | ||
@@ -151,0 +155,0 @@ remainingPath = remainingPath.replace(/^\/\?/, '?'); |
@@ -578,3 +578,3 @@ (function (global, factory) { | ||
if (options === void 0) { options = {}; } | ||
var _a = options.queryParamsMode, queryParamsMode = _a === void 0 ? 'default' : _a, _b = options.strictTrailingSlash, strictTrailingSlash = _b === void 0 ? false : _b, _c = options.strongMatching, strongMatching = _c === void 0 ? true : _c; | ||
var _a = options.queryParamsMode, queryParamsMode = _a === void 0 ? 'default' : _a, _b = options.strictTrailingSlash, strictTrailingSlash = _b === void 0 ? false : _b, _c = options.strongMatching, strongMatching = _c === void 0 ? true : _c, _d = options.caseSensitive, caseSensitive = _d === void 0 ? false : _d; | ||
var isRoot = nodes.length === 1 && nodes[0].name === ''; | ||
@@ -592,7 +592,11 @@ var _loop_1 = function (child) { | ||
if (!child.children.length) { | ||
match = child.parser.test(segment, options); | ||
match = child.parser.test(segment, { | ||
caseSensitive: caseSensitive, | ||
strictTrailingSlash: strictTrailingSlash | ||
}); | ||
} | ||
if (!match) { | ||
match = child.parser.partialTest(segment, { | ||
delimited: strongMatching | ||
delimited: strongMatching, | ||
caseSensitive: caseSensitive | ||
}); | ||
@@ -608,3 +612,3 @@ } | ||
} | ||
remainingPath = segment.replace(consumedPath, ''); | ||
remainingPath = segment.replace(new RegExp('^' + consumedPath, 'i'), ''); | ||
if (!strictTrailingSlash && !child.children.length) { | ||
@@ -611,0 +615,0 @@ remainingPath = remainingPath.replace(/^\/\?/, '?'); |
@@ -18,3 +18,4 @@ import { omit, parse } from 'search-params' | ||
strictTrailingSlash = false, | ||
strongMatching = true | ||
strongMatching = true, | ||
caseSensitive = false | ||
} = options | ||
@@ -36,3 +37,6 @@ const isRoot = nodes.length === 1 && nodes[0].name === '' | ||
if (!child.children.length) { | ||
match = child.parser.test(segment, options) | ||
match = child.parser.test(segment, { | ||
caseSensitive, | ||
strictTrailingSlash | ||
}) | ||
} | ||
@@ -42,3 +46,4 @@ | ||
match = child.parser.partialTest(segment, { | ||
delimited: strongMatching | ||
delimited: strongMatching, | ||
caseSensitive | ||
}) | ||
@@ -52,2 +57,3 @@ } | ||
}) | ||
if (!strictTrailingSlash && !child.children.length) { | ||
@@ -57,3 +63,6 @@ consumedPath = consumedPath.replace(/\/$/, '') | ||
remainingPath = segment.replace(consumedPath, '') | ||
remainingPath = segment.replace( | ||
new RegExp('^' + consumedPath, 'i'), | ||
'' | ||
) | ||
@@ -60,0 +69,0 @@ if (!strictTrailingSlash && !child.children.length) { |
@@ -42,2 +42,3 @@ import { Path } from 'path-parser' | ||
strongMatching?: boolean | ||
caseSensitive?: boolean | ||
} | ||
@@ -44,0 +45,0 @@ export { QueryParamsOptions } |
{ | ||
"name": "route-node", | ||
"version": "3.0.3", | ||
"version": "3.1.0", | ||
"description": "A package to create a tree of named routes", | ||
@@ -5,0 +5,0 @@ "main": "dist/cjs/route-node.js", |
@@ -86,3 +86,3 @@ [![npm version](https://badge.fury.io/js/route-node.svg)](http://badge.fury.io/js/route-node) | ||
- `'default'`: building follows path definitions | ||
- `'none'`: when building, trailing slash is removed | ||
- `'never'`: when building, trailing slash is removed | ||
- `'always'`: when building, trailing slash is added | ||
@@ -94,1 +94,2 @@ - `queryParamsMode`: | ||
- `queryParams`: [options for query parameters](https://github.com/troch/search-params#options) | ||
- `caseSensitive`: whether path matching is case sensitive or not (default to `false`) |
@@ -23,2 +23,3 @@ import { Path } from 'path-parser'; | ||
strongMatching?: boolean; | ||
caseSensitive?: boolean; | ||
} | ||
@@ -25,0 +26,0 @@ export { QueryParamsOptions }; |
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
252023
2966
94