Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit c7e48c0

Browse files
committed
fixup! fix(angular-loader): do not depend on "closure" globals that may not be available
1 parent 4c0c834 commit c7e48c0

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/loader.prefix

+5
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,16 @@
55
*/
66
'use strict';
77
(function() {
8+
// NOTE:
9+
// These functions are copied here from `src/Angular.js`, because they are needed inside the
10+
// `angular-loader.js` closure and need to be available before the main `angular.js` script has
11+
// been loaded.
812
function isFunction(value) {return typeof value === 'function';}
913
function isDefined(value) {return typeof value !== 'undefined';}
1014
function isNumber(value) {return typeof value === 'number';}
1115
function isObject(value) {return value !== null && typeof value === 'object';}
1216
function isScope(obj) {return obj && obj.$evalAsync && obj.$watch;}
17+
function isUndefined(value) {return typeof value === 'undefined';}
1318
function isWindow(obj) {return obj && obj.window === obj;}
1419
function sliceArgs(args, startIndex) {return Array.prototype.slice.call(args, startIndex || 0);}
1520
function toJsonReplacer(key, value) {

src/stringify.js

+3-8
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,16 @@
22

33
/* exported toDebugString */
44

5-
// This file is also included in `angular-loader`, so `copy()` might not always be available in the
6-
// closure. In such cases, it is lazily retrieved as `angular.copy()` when needed.
7-
var copyFn;
8-
95
function serializeObject(obj, maxDepth) {
106
var seen = [];
117

128
// There is no direct way to stringify object until reaching a specific depth
139
// and a very deep object can cause a performance issue, so we copy the object
1410
// based on this specific depth and then stringify it.
1511
if (isValidObjectMaxDepth(maxDepth)) {
16-
if (!copyFn) {
17-
copyFn = copy || angular.copy;
18-
}
19-
obj = copyFn(obj, null, maxDepth);
12+
// This file is also included in `angular-loader`, so `copy()` might not always be available in
13+
// the closure. Therefore, it is lazily retrieved as `angular.copy()` when needed.
14+
obj = angular.copy(obj, null, maxDepth);
2015
}
2116
return JSON.stringify(obj, function(key, val) {
2217
val = toJsonReplacer(key, val);

0 commit comments

Comments
 (0)