Skip to content

Commit 872d085

Browse files
chore($urlMatcherFactory): refactor UrlMatcher.concat
1 parent db12c85 commit 872d085

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

src/urlMatcherFactory.js

+15-4
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,12 @@ UrlMatcher.prototype.concat = function (pattern, config) {
184184
// Because order of search parameters is irrelevant, we can add our own search
185185
// parameters to the end of the new pattern. Parse the new pattern by itself
186186
// and then join the bits together, but it's much easier to do this on a string level.
187-
return $$UMFP.compile(this.sourcePath + pattern + this.sourceSearch, config);
187+
var defaultConfig = {
188+
caseInsensitive: $$UMFP.caseInsensitive(),
189+
strict: $$UMFP.strictMode(),
190+
squash: $$UMFP.defaultSquashPolicy()
191+
};
192+
return new UrlMatcher(this.sourcePath + pattern + this.sourceSearch, extend(defaultConfig, config));
188193
};
189194

190195
UrlMatcher.prototype.toString = function () {
@@ -587,9 +592,12 @@ function $UrlMatcherFactory() {
587592
* Defines whether URL matching should be case sensitive (the default behavior), or not.
588593
*
589594
* @param {boolean} value `false` to match URL in a case sensitive manner; otherwise `true`;
595+
* @return the current value of caseInsensitive
590596
*/
591597
this.caseInsensitive = function(value) {
592-
isCaseInsensitive = value;
598+
if (isDefined(value))
599+
isCaseInsensitive = value;
600+
return isCaseInsensitive;
593601
};
594602

595603
/**
@@ -600,10 +608,13 @@ function $UrlMatcherFactory() {
600608
* @description
601609
* Defines whether URLs should match trailing slashes, or not (the default behavior).
602610
*
603-
* @param {boolean} value `false` to match trailing slashes in URLs, otherwise `true`.
611+
* @param {boolean=} value `false` to match trailing slashes in URLs, otherwise `true`.
612+
* @return the current value of strictMode
604613
*/
605614
this.strictMode = function(value) {
606-
isStrictMode = value;
615+
if (isDefined(value))
616+
isStrictMode = value;
617+
return isStrictMode;
607618
};
608619

609620
/**

0 commit comments

Comments
 (0)