Total Complexity | 4 |
Complexity/F | 2 |
Lines of Code | 33 |
Function Count | 2 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | (function () { |
||
2 | hf_data.forEach(function(data, index) { |
||
|
|||
3 | if ( data.type === 'directory' ) { |
||
4 | var widget = new HomeFinder.Widgets.AdvertiserDirectory({ |
||
5 | container: 'directoryPreview-' + index, |
||
6 | data: { |
||
7 | profileName: data.affiliate, |
||
8 | maxCount: data.count |
||
9 | } |
||
10 | }); |
||
11 | } else if ( data.type === 'search' ) { |
||
12 | var widget = new HomeFinder.Widgets.Search({ |
||
13 | container: 'searchPreview-' + index, |
||
14 | data: { |
||
15 | affiliate: { name: data.affiliate }, |
||
16 | area: { city: data.primary_city, state: data.primary_state }, |
||
17 | nearbyAreas: [ |
||
18 | { city: data.nearby_city_1, state: data.nearby_state_1 }, |
||
19 | { city: data.nearby_city_2, state: data.nearby_state_2 }, |
||
20 | { city: data.nearby_city_3, state: data.nearby_state_3 }, |
||
21 | { city: data.nearby_city_4, state: data.nearby_state_4 } |
||
22 | ] |
||
23 | } |
||
24 | }); |
||
25 | } else { |
||
26 | var hfWidget = [{ |
||
27 | type: data.type, |
||
28 | container: data.container + '-' + index |
||
29 | }]; |
||
30 | HomeFinder.widgetLoader.getWidgets( hfWidget ); |
||
31 | } |
||
32 | }); |
||
33 | })(); |
||
34 |
This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.
To learn more about declaring variables in Javascript, see the MDN.