Skip to content

Commit 9fbfa28

Browse files
committed
fix sonar block
1 parent a70bcbc commit 9fbfa28

File tree

7 files changed

+35
-29
lines changed

7 files changed

+35
-29
lines changed

dist/iclient9-leaflet.js

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12439,13 +12439,15 @@ SuperMap.ElasticSearchService = SuperMap.Class({
1243912439
},
1244012440

1244112441
validateDatas: function (datas) {
12442-
var me = this;
12443-
if (datas instanceof Array) {
12444-
datas.map(function (data) {
12445-
me._validateData(data);
12446-
});
12447-
} else {
12448-
me._validateData(data);
12442+
if (!datas) {
12443+
return;
12444+
}
12445+
if (!(datas instanceof Array)) {
12446+
datas = [datas];
12447+
}
12448+
var i, len = datas.length;
12449+
for (i = 0; i < len; i++) {
12450+
this._validateData(datas[i]);
1244912451
}
1245012452
},
1245112453

@@ -49983,7 +49985,7 @@ L.TextSymbolizer = L.Path.extend({
4998349985
this._text = (attributes && this.properties.textField) ?
4998449986
attributes[this.properties.textField] || "" : "";
4998549987
}
49986-
options = this.options;
49988+
var options = this.options;
4998749989
this._pxBounds = L.bounds(this._point, this._point);
4998849990
L.Symbolizer.prototype.render.apply(this, [renderer, style]);
4998949991
this.options = L.Util.extend(options, style);
@@ -50033,7 +50035,7 @@ L.Canvas.Renderer.include({
5003350035
if (!this._drawing || layer._empty()) {
5003450036
return;
5003550037
}
50036-
container = this.getContainer();
50038+
var container = this.getContainer();
5003750039
var size = this._map.getSize();
5003850040
container.width = size.x;
5003950041
container.height = size.y;
@@ -50460,7 +50462,7 @@ var VectorTile = L.Class.extend({
5046050462
styleOverride = tileLayer._overriddenStyles[styleKey];
5046150463

5046250464
styleOptions = styleOverride ? styleOverride : styleOptions;
50463-
styleOptions = (styleOptions instanceof Function) ? styleOptions(feat.properties, coords.z) : styleOptions;
50465+
styleOptions = (styleOptions instanceof Function) ? styleOptions(feature.properties, coords.z) : styleOptions;
5046450466
styleOptions = !(styleOptions instanceof Array) ? [styleOptions] : styleOptions;
5046550467
return styleOptions;
5046650468
},

dist/iclient9-leaflet.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/iclient9-openlayers.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10470,13 +10470,15 @@ SuperMap.ElasticSearchService = SuperMap.Class({
1047010470
},
1047110471

1047210472
validateDatas: function (datas) {
10473-
var me = this;
10474-
if (datas instanceof Array) {
10475-
datas.map(function (data) {
10476-
me._validateData(data);
10477-
});
10478-
} else {
10479-
me._validateData(data);
10473+
if (!datas) {
10474+
return;
10475+
}
10476+
if (!(datas instanceof Array)) {
10477+
datas = [datas];
10478+
}
10479+
var i, len = datas.length;
10480+
for (i = 0; i < len; i++) {
10481+
this._validateData(datas[i]);
1048010482
}
1048110483
},
1048210484

dist/iclient9-openlayers.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/common/thirdparty/elasticsearch/ElasticSearchService.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -126,13 +126,15 @@ SuperMap.ElasticSearchService = SuperMap.Class({
126126
},
127127

128128
validateDatas: function (datas) {
129-
var me = this;
130-
if (datas instanceof Array) {
131-
datas.map(function (data) {
132-
me._validateData(data);
133-
});
134-
} else {
135-
me._validateData(data);
129+
if (!datas) {
130+
return;
131+
}
132+
if (!(datas instanceof Array)) {
133+
datas = [datas];
134+
}
135+
var i, len = datas.length;
136+
for (i = 0; i < len; i++) {
137+
this._validateData(datas[i]);
136138
}
137139
},
138140

src/leaflet/overlay/vectortile/TextSymbolizer.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ L.TextSymbolizer = L.Path.extend({
4040
this._text = (attributes && this.properties.textField) ?
4141
attributes[this.properties.textField] || "" : "";
4242
}
43-
options = this.options;
43+
var options = this.options;
4444
this._pxBounds = L.bounds(this._point, this._point);
4545
L.Symbolizer.prototype.render.apply(this, [renderer, style]);
4646
this.options = L.Util.extend(options, style);
@@ -90,7 +90,7 @@ L.Canvas.Renderer.include({
9090
if (!this._drawing || layer._empty()) {
9191
return;
9292
}
93-
container = this.getContainer();
93+
var container = this.getContainer();
9494
var size = this._map.getSize();
9595
container.width = size.x;
9696
container.height = size.y;

src/leaflet/overlay/vectortile/VectorTile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ var VectorTile = L.Class.extend({
155155
styleOverride = tileLayer._overriddenStyles[styleKey];
156156

157157
styleOptions = styleOverride ? styleOverride : styleOptions;
158-
styleOptions = (styleOptions instanceof Function) ? styleOptions(feat.properties, coords.z) : styleOptions;
158+
styleOptions = (styleOptions instanceof Function) ? styleOptions(feature.properties, coords.z) : styleOptions;
159159
styleOptions = !(styleOptions instanceof Array) ? [styleOptions] : styleOptions;
160160
return styleOptions;
161161
},

0 commit comments

Comments
 (0)