From ad9c41d2e723d50e30dd3452fbd274b7057dc3d9 Mon Sep 17 00:00:00 2001 From: Roy Teeuwen Date: Wed, 3 Feb 2016 23:03:56 +0100 Subject: [PATCH] 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. --- src/urlMatcherFactory.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/urlMatcherFactory.js b/src/urlMatcherFactory.js index 30ff0be0b..bc4e1eb4e 100644 --- a/src/urlMatcherFactory.js +++ b/src/urlMatcherFactory.js @@ -599,7 +599,7 @@ 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. @@ -607,19 +607,19 @@ function $UrlMatcherFactory() { 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; @@ -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,