Skip to content

Commit

Permalink
fix(instrumentation): fix patchin provider object with array properties
Browse files Browse the repository at this point in the history
  • Loading branch information
btford committed Jul 9, 2013
1 parent c002d05 commit a5ecad5
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions js/inject/debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -682,13 +682,22 @@ var inject = function () {
$provide[met] = function (name, definition) {
if (typeof name === 'object') {
angular.forEach(name, function (value, key) {
name[key] = function () {
var isArray = value instanceof Array;
var originalValue = isArray ? value[value.length - 1] : value;

var newValue = function () {
debug.deps.push({
name: key,
imports: annotate(value)
imports: annotate(originalValue)
});
return value.apply(this, arguments);
return originalValue.apply(this, arguments);
};

if (isArray) {
value[value.length - 1] = newValue;
} else {
name[value] = newValue;
}
});
} else {
debug.deps.push({
Expand Down

0 comments on commit a5ecad5

Please sign in to comment.