diff options
author | Tatiana Ovchinnikova <t.v.ovtchinnikova@gmail.com> | 2022-05-25 14:22:41 -0500 |
---|---|---|
committer | Tatiana Ovchinnikova <t.v.ovtchinnikova@gmail.com> | 2022-05-26 11:46:41 -0500 |
commit | 375ee8e424d913b3759b67e9263a38a56c84942c (patch) | |
tree | 1d568ca50db3915c3fb7b72c19695def9786e6ec /xstatic/pkg/angular/data/angular-loader.js | |
parent | 150699b9ded48aceb7e3d8a721622acb3b6801bf (diff) | |
download | xstatic-angular-master.tar.gz |
This is the official 1.8.2 build from angularjs.org.
The most recent changes are included, and ngScenario has been
removed from the project.
Change-Id: Id1e700d56b9394cc648d27f03ffea33171ef7cf2
Diffstat (limited to 'xstatic/pkg/angular/data/angular-loader.js')
-rw-r--r-- | xstatic/pkg/angular/data/angular-loader.js | 96 |
1 files changed, 92 insertions, 4 deletions
diff --git a/xstatic/pkg/angular/data/angular-loader.js b/xstatic/pkg/angular/data/angular-loader.js index 77111d5..6bad592 100644 --- a/xstatic/pkg/angular/data/angular-loader.js +++ b/xstatic/pkg/angular/data/angular-loader.js @@ -1,13 +1,39 @@ /** * @license AngularJS v1.8.2 - * (c) 2010-2020 Google, Inc. http://angularjs.org + * (c) 2010-2020 Google LLC. http://angularjs.org * License: MIT */ (function() {'use strict'; - function isFunction(value) {return typeof value === 'function';}; + // NOTE: + // These functions are copied here from `src/Angular.js`, because they are needed inside the + // `angular-loader.js` closure and need to be available before the main `angular.js` script has + // been loaded. + function isFunction(value) {return typeof value === 'function';} + function isDefined(value) {return typeof value !== 'undefined';} + function isNumber(value) {return typeof value === 'number';} + function isObject(value) {return value !== null && typeof value === 'object';} + function isScope(obj) {return obj && obj.$evalAsync && obj.$watch;} + function isUndefined(value) {return typeof value === 'undefined';} + function isWindow(obj) {return obj && obj.window === obj;} + function sliceArgs(args, startIndex) {return Array.prototype.slice.call(args, startIndex || 0);} + function toJsonReplacer(key, value) { + var val = value; + + if (typeof key === 'string' && key.charAt(0) === '$' && key.charAt(1) === '$') { + val = undefined; + } else if (isWindow(value)) { + val = '$WINDOW'; + } else if (value && window.document === value) { + val = '$DOCUMENT'; + } else if (isScope(value)) { + val = '$SCOPE'; + } + + return val; + } -/* global toDebugString: true */ +/* exported toDebugString */ function serializeObject(obj, maxDepth) { var seen = []; @@ -43,6 +69,67 @@ function toDebugString(obj, maxDepth) { return obj; } +/* exported + minErrConfig, + errorHandlingConfig, + isValidObjectMaxDepth +*/ + +var minErrConfig = { + objectMaxDepth: 5, + urlErrorParamsEnabled: true +}; + +/** + * @ngdoc function + * @name angular.errorHandlingConfig + * @module ng + * @kind function + * + * @description + * Configure several aspects of error handling in AngularJS if used as a setter or return the + * current configuration if used as a getter. The following options are supported: + * + * - **objectMaxDepth**: The maximum depth to which objects are traversed when stringified for error messages. + * + * Omitted or undefined options will leave the corresponding configuration values unchanged. + * + * @param {Object=} config - The configuration object. May only contain the options that need to be + * updated. Supported keys: + * + * * `objectMaxDepth` **{Number}** - The max depth for stringifying objects. Setting to a + * non-positive or non-numeric value, removes the max depth limit. + * Default: 5 + * + * * `urlErrorParamsEnabled` **{Boolean}** - Specifies whether the generated error url will + * contain the parameters of the thrown error. Disabling the parameters can be useful if the + * generated error url is very long. + * + * Default: true. When used without argument, it returns the current value. + */ +function errorHandlingConfig(config) { + if (isObject(config)) { + if (isDefined(config.objectMaxDepth)) { + minErrConfig.objectMaxDepth = isValidObjectMaxDepth(config.objectMaxDepth) ? config.objectMaxDepth : NaN; + } + if (isDefined(config.urlErrorParamsEnabled) && isBoolean(config.urlErrorParamsEnabled)) { + minErrConfig.urlErrorParamsEnabled = config.urlErrorParamsEnabled; + } + } else { + return minErrConfig; + } +} + +/** + * @private + * @param {Number} maxDepth + * @return {boolean} + */ +function isValidObjectMaxDepth(maxDepth) { + return isNumber(maxDepth) && maxDepth > 0; +} + + /** * @description * @@ -76,7 +163,7 @@ function toDebugString(obj, maxDepth) { function minErr(module, ErrorConstructor) { ErrorConstructor = ErrorConstructor || Error; - var url = 'https://errors.angularjs.org/"1.8.2"/'; + var url = 'https://errors.angularjs.org/1.8.2/'; var regex = url.replace('.', '\\.') + '[\\s\\S]*'; var errRegExp = new RegExp(regex, 'g'); @@ -548,3 +635,4 @@ setupModuleLoader(window); * } } */ angular.Module; + |