Skip to content

Commit fadba54

Browse files
committed
fixed eslint
1 parent 9c672cc commit fadba54

File tree

5 files changed

+33
-27
lines changed

5 files changed

+33
-27
lines changed

expensive-keys.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@
4242
function valuesInMB(obj) {
4343
var result = {};
4444
Object.keys(obj).forEach(function (key) {
45-
var value = obj[key];
46-
if (typeof value === 'number') {
47-
result[key] = toSizeMB(obj[key]);
45+
var val = obj[key];
46+
if (typeof val === 'number') {
47+
result[key] = toSizeMB(val);
4848
}
4949
});
5050
return result;

ng-count-watchers.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@
77
test = {};
88

99
// go through each element. Count watchers if it has scope or isolate scope
10-
for (i=0; i < len; i++) {
10+
/* eslint no-for-loops:0 */
11+
for (i = 0; i < len; i++) {
1112
/* global angular */
1213
data = angular.element(all[i]).data();
1314
scope = data.$scope || data.$isolateScope;
1415
if (scope && scope.$$watchers) {
15-
if ( ! test[ scope.$id ] ) {
16+
if ( !test[ scope.$id ] ) {
1617
test[ scope.$id ] = true;
1718
count += scope.$$watchers.length;
1819
}

ng-find-expensive-digest.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@
1717
return takes;
1818
});
1919
var merged = selectors.map(function (selector, k) {
20-
return { selector: selector, takes: durations[k] };
20+
return {
21+
selector: selector,
22+
takes: durations[k]
23+
};
2124
});
2225
merged = merged.sort(function (a, b) {
2326
return b.takes - a.takes;

ng-find-scope-property.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@
99
var found = [];
1010

1111
/* global angular */
12-
for (i=0; i < len; i++) {
12+
/* eslint no-for-loops:0 */
13+
for (i = 0; i < len; i++) {
1314
data = angular.element(all[i]).data();
1415
scope = data.$scope || data.$isolateScope;
1516
if (scope && scope.hasOwnProperty(name)) {
16-
if ( ! test[ scope.$id ] ) {
17+
if ( !test[ scope.$id ] ) {
1718
test[ scope.$id ] = true;
1819
found.push(scope);
1920
}

ng-scope-size.js

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,6 @@
88
test = {},
99
scopes = 0;
1010

11-
// go through each element. Count watchers if it has scope or isolate scope
12-
for (i=0; i < len; i++) {
13-
/* global angular */
14-
data = angular.element(all[i]).data();
15-
scope = data.$scope || data.$isolateScope;
16-
if (scope) {
17-
if ( ! test[ scope.$id ] ) {
18-
test[ scope.$id ] = true;
19-
count += sizeof(scope);
20-
scopes += 1;
21-
}
22-
}
23-
}
24-
console.log(scopes, 'scopes have', count, 'bytes attached');
25-
return count;
26-
2711
/*
2812
sizeof.js modified for angular scope client data computation
2913
A function to calculate the approximate memory usage of objects
@@ -41,10 +25,10 @@
4125

4226
// initialise the list of objects and size
4327
var objects = [object];
44-
var size = 0;
28+
var size = 0;
4529

4630
// loop over the objects
47-
for (var index = 0; index < objects.length; index ++){
31+
for (var index = 0; index < objects.length; index += 1) {
4832

4933
// determine the type of the object
5034
switch (typeof objects[index]) {
@@ -73,7 +57,7 @@
7357
// determine whether the value has already been processed
7458
var processed = false;
7559
/* jshint -W073 */
76-
for (var search = 0; search < objects.length; search ++){
60+
for (var search = 0; search < objects.length; search += 1){
7761
if (objects[search] === objects[index][key]){
7862
processed = true;
7963
break;
@@ -96,4 +80,21 @@
9680

9781
}
9882

83+
// go through each element. Count watchers if it has scope or isolate scope
84+
/* eslint no-for-loops:0 */
85+
for (i = 0; i < len; i++) {
86+
/* global angular */
87+
data = angular.element(all[i]).data();
88+
scope = data.$scope || data.$isolateScope;
89+
if (scope) {
90+
if ( !test[ scope.$id ] ) {
91+
test[ scope.$id ] = true;
92+
count += sizeof(scope);
93+
scopes += 1;
94+
}
95+
}
96+
}
97+
console.log(scopes, 'scopes have', count, 'bytes attached');
98+
return count;
99+
99100
}());

0 commit comments

Comments
 (0)