Skip to content

Commit

Permalink
Revert "feat(UrlMatcher): Add param only type names"
Browse files Browse the repository at this point in the history
  • Loading branch information
nateabele committed Oct 6, 2015
1 parent cc10786 commit f5d308f
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 17 deletions.
3 changes: 1 addition & 2 deletions src/urlMatcherFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -917,8 +917,7 @@ function $UrlMatcherFactory() {
}

function getType(config, urlType, location) {
if (config.type && urlType.name !== 'string') throw new Error("Param '"+id+"' has two type configurations.");
if (config.type && urlType.name === 'string' && $types[config.type]) return $types[config.type];
if (config.type && urlType) throw new Error("Param '"+id+"' has two type configurations.");
if (urlType) return urlType;
if (!config.type) return (location === "config" ? $types.any : $types.string);
return config.type instanceof Type ? config.type : new Type(config.type);
Expand Down
15 changes: 0 additions & 15 deletions test/urlMatcherFactorySpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -520,21 +520,6 @@ describe("urlMatcherFactory", function () {
expect(m.format({ foo: 5, flag: true })).toBe("/5/1");
});

it("should match types named only in params", function () {
var m = new UrlMatcher("/{foo}/{flag}", {
params: {
foo: {
type: 'int'
},
flag: {
type: 'bool'
}
}
});
expect(m.exec("/1138/1")).toEqual({ foo: 1138, flag: true });
expect(m.format({ foo: 5, flag: true })).toBe("/5/1");
});

it("should encode/decode dates", function () {
var m = new UrlMatcher("/calendar/{date:date}"),
result = m.exec("/calendar/2014-03-26");
Expand Down

0 comments on commit f5d308f

Please sign in to comment.