From 94764ee08910726db1db7a1101c3001500306dea Mon Sep 17 00:00:00 2001 From: Vojta Jina Date: Thu, 14 Nov 2013 14:18:55 -0800 Subject: [PATCH] fix(minErr): remove references to internals APIs So that we can use minErr with angular-loader, before full angular is loaded. This also fixes replacing the version during the build. --- lib/grunt/utils.js | 2 +- src/minErr.js | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/grunt/utils.js b/lib/grunt/utils.js index 314ac94e17fc..90613a295978 100644 --- a/lib/grunt/utils.js +++ b/lib/grunt/utils.js @@ -168,7 +168,7 @@ module.exports = { var mapFile = minFile + '.map'; var mapFileName = mapFile.match(/[^\/]+$/)[0]; var errorFileName = file.replace(/\.js$/, '-errors.json'); - var versionNumber = this.getVersion().number; + var versionNumber = this.getVersion().full; shell.exec( 'java ' + this.java32flags() + ' ' + diff --git a/src/minErr.js b/src/minErr.js index 4ebcf7221226..e42a0817a3ab 100644 --- a/src/minErr.js +++ b/src/minErr.js @@ -35,11 +35,11 @@ function minErr(module) { template = arguments[1], templateArgs = arguments, stringify = function (obj) { - if (isFunction(obj)) { + if (typeof obj === 'function') { return obj.toString().replace(/ \{[\s\S]*$/, ''); - } else if (isUndefined(obj)) { + } else if (typeof obj === 'undefined') { return 'undefined'; - } else if (!isString(obj)) { + } else if (typeof obj !== 'string') { return JSON.stringify(obj); } return obj; @@ -51,11 +51,11 @@ function minErr(module) { if (index + 2 < templateArgs.length) { arg = templateArgs[index + 2]; - if (isFunction(arg)) { + if (typeof arg === 'function') { return arg.toString().replace(/ ?\{[\s\S]*$/, ''); - } else if (isUndefined(arg)) { + } else if (typeof arg === 'undefined') { return 'undefined'; - } else if (!isString(arg)) { + } else if (typeof arg !== 'string') { return toJson(arg); } return arg; @@ -63,7 +63,7 @@ function minErr(module) { return match; }); - message = message + '\nhttp://errors.angularjs.org/' + version.full + '/' + + message = message + '\nhttp://errors.angularjs.org/"NG_VERSION_FULL"/' + (module ? module + '/' : '') + code; for (i = 2; i < arguments.length; i++) { message = message + (i == 2 ? '?' : '&') + 'p' + (i-2) + '=' +