Make sure all for-in loops works as expected

This commit is contained in:
Dmitriy Simushev 2016-06-02 23:20:24 +00:00
parent 199438285c
commit d5130ed655
2 changed files with 5 additions and 3 deletions

View File

@ -377,9 +377,7 @@
}
try {
var packageObject = this.mibewAPI.decodePackage(data);
// TODO: Try to use 'for' loop instead of 'for in' loop
// or use hasOwnProperty method
for (var i in packageObject.requests) {
for (var i = 0, len = packageObject.requests.length; i < len; i++) {
this.processRequest(packageObject.requests[i]);
}
} catch (e) {

View File

@ -87,6 +87,10 @@ MibewAPI.prototype.checkFunction = function(functionObject, filterReservedFuncti
);
argumentsLoop:
for (var argName in functionObject.arguments){
if (!functionObject.arguments.hasOwnProperty(argName)) {
// Work with own properties only.
continue;
}
for (var i = 0; i < mandatoryArgumentsList.length; i++) {
if (argName == mandatoryArgumentsList[i]) {
mandatoryArgumentsCount++;