Skip to content

Commit f5d308f

Browse files
committed
Revert "feat(UrlMatcher): Add param only type names"
1 parent cc10786 commit f5d308f

File tree

2 files changed

+1
-17
lines changed

2 files changed

+1
-17
lines changed

src/urlMatcherFactory.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -917,8 +917,7 @@ function $UrlMatcherFactory() {
917917
}
918918

919919
function getType(config, urlType, location) {
920-
if (config.type && urlType.name !== 'string') throw new Error("Param '"+id+"' has two type configurations.");
921-
if (config.type && urlType.name === 'string' && $types[config.type]) return $types[config.type];
920+
if (config.type && urlType) throw new Error("Param '"+id+"' has two type configurations.");
922921
if (urlType) return urlType;
923922
if (!config.type) return (location === "config" ? $types.any : $types.string);
924923
return config.type instanceof Type ? config.type : new Type(config.type);

test/urlMatcherFactorySpec.js

-15
Original file line numberDiff line numberDiff line change
@@ -520,21 +520,6 @@ describe("urlMatcherFactory", function () {
520520
expect(m.format({ foo: 5, flag: true })).toBe("/5/1");
521521
});
522522

523-
it("should match types named only in params", function () {
524-
var m = new UrlMatcher("/{foo}/{flag}", {
525-
params: {
526-
foo: {
527-
type: 'int'
528-
},
529-
flag: {
530-
type: 'bool'
531-
}
532-
}
533-
});
534-
expect(m.exec("/1138/1")).toEqual({ foo: 1138, flag: true });
535-
expect(m.format({ foo: 5, flag: true })).toBe("/5/1");
536-
});
537-
538523
it("should encode/decode dates", function () {
539524
var m = new UrlMatcher("/calendar/{date:date}"),
540525
result = m.exec("/calendar/2014-03-26");

0 commit comments

Comments
 (0)