Skip to content

Commit ad9c41d

Browse files
author
Roy Teeuwen
committed
fix($urlMatcherFactory): Fix to make the YUI Javascript compressor work
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.
1 parent 508f9ce commit ad9c41d

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/urlMatcherFactory.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -599,27 +599,27 @@ function $UrlMatcherFactory() {
599599
function valFromString(val) { return val != null ? val.toString().replace(/~2F/g, "/").replace(/~~/g, "~") : val; }
600600

601601
var $types = {}, enqueue = true, typeQueue = [], injector, defaultTypes = {
602-
string: {
602+
"string": {
603603
encode: valToString,
604604
decode: valFromString,
605605
// TODO: in 1.0, make string .is() return false if value is undefined/null by default.
606606
// In 0.2.x, string params are optional by default for backwards compat
607607
is: function(val) { return val == null || !isDefined(val) || typeof val === "string"; },
608608
pattern: /[^/]*/
609609
},
610-
int: {
610+
"int": {
611611
encode: valToString,
612612
decode: function(val) { return parseInt(val, 10); },
613613
is: function(val) { return isDefined(val) && this.decode(val.toString()) === val; },
614614
pattern: /\d+/
615615
},
616-
bool: {
616+
"bool": {
617617
encode: function(val) { return val ? 1 : 0; },
618618
decode: function(val) { return parseInt(val, 10) !== 0; },
619619
is: function(val) { return val === true || val === false; },
620620
pattern: /0|1/
621621
},
622-
date: {
622+
"date": {
623623
encode: function (val) {
624624
if (!this.is(val))
625625
return undefined;
@@ -638,14 +638,14 @@ function $UrlMatcherFactory() {
638638
pattern: /[0-9]{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[1-2][0-9]|3[0-1])/,
639639
capture: /([0-9]{4})-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])/
640640
},
641-
json: {
641+
"json": {
642642
encode: angular.toJson,
643643
decode: angular.fromJson,
644644
is: angular.isObject,
645645
equals: angular.equals,
646646
pattern: /[^/]*/
647647
},
648-
any: { // does not encode/decode
648+
"any": { // does not encode/decode
649649
encode: angular.identity,
650650
decode: angular.identity,
651651
equals: angular.equals,

0 commit comments

Comments
 (0)