Skip to content

Commit

Permalink
fix($urlMatcherFactory): Fix to make the YUI Javascript compressor work
Browse files Browse the repository at this point in the history
The current implementation of the yuicompressor throws an error when minifying the defaultTypes of the urlMatcherFactory because int is an invalid property id.
Changed the property names to string values.
  • Loading branch information
Roy Teeuwen committed Feb 3, 2016
1 parent 508f9ce commit ad9c41d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/urlMatcherFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -599,27 +599,27 @@ function $UrlMatcherFactory() {
function valFromString(val) { return val != null ? val.toString().replace(/~2F/g, "/").replace(/~~/g, "~") : val; }

var $types = {}, enqueue = true, typeQueue = [], injector, defaultTypes = {
string: {
"string": {
encode: valToString,
decode: valFromString,
// TODO: in 1.0, make string .is() return false if value is undefined/null by default.
// In 0.2.x, string params are optional by default for backwards compat
is: function(val) { return val == null || !isDefined(val) || typeof val === "string"; },
pattern: /[^/]*/
},
int: {
"int": {
encode: valToString,
decode: function(val) { return parseInt(val, 10); },
is: function(val) { return isDefined(val) && this.decode(val.toString()) === val; },
pattern: /\d+/
},
bool: {
"bool": {
encode: function(val) { return val ? 1 : 0; },
decode: function(val) { return parseInt(val, 10) !== 0; },
is: function(val) { return val === true || val === false; },
pattern: /0|1/
},
date: {
"date": {
encode: function (val) {
if (!this.is(val))
return undefined;
Expand All @@ -638,14 +638,14 @@ function $UrlMatcherFactory() {
pattern: /[0-9]{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[1-2][0-9]|3[0-1])/,
capture: /([0-9]{4})-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])/
},
json: {
"json": {
encode: angular.toJson,
decode: angular.fromJson,
is: angular.isObject,
equals: angular.equals,
pattern: /[^/]*/
},
any: { // does not encode/decode
"any": { // does not encode/decode
encode: angular.identity,
decode: angular.identity,
equals: angular.equals,
Expand Down

0 comments on commit ad9c41d

Please sign in to comment.