Skip to content

Commit 530c4a3

Browse files
committed
fixed PR issues
1 parent f646ab4 commit 530c4a3

File tree

3 files changed

+21
-17
lines changed

3 files changed

+21
-17
lines changed

lib/solidity/coder.js

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -133,39 +133,42 @@ SolidityCoder.prototype.encodeMultiWithOffset = function (types, solidityTypes,
133133
};
134134

135135
SolidityCoder.prototype.encodeWithOffset = function (type, solidityType, encoded, offset) {
136+
/* jshint maxcomplexity: 17 */
137+
/* jshint maxdepth: 5 */
138+
136139
var self = this;
137140
var encodingMode={dynamic:1,static:2,other:3};
138-
141+
139142
var mode=(solidityType.isDynamicArray(type)?encodingMode.dynamic:(solidityType.isStaticArray(type)?encodingMode.static:encodingMode.other));
140143

141-
if(mode!=encodingMode.other){
144+
if(mode !== encodingMode.other){
142145
var nestedName = solidityType.nestedName(type);
143146
var nestedStaticPartLength = solidityType.staticPartLength(nestedName);
144-
var result = (mode==encodingMode.dynamic?encoded[0]:"");
145-
147+
var result = (mode === encodingMode.dynamic ? encoded[0] : '');
148+
146149
if (solidityType.isDynamicArray(nestedName)) {
147-
var previousLength = (mode==encodingMode.dynamic?2:0);
148-
150+
var previousLength = (mode === encodingMode.dynamic ? 2 : 0);
151+
149152
for (var i = 0; i < encoded.length; i++) {
150153
// calculate length of previous item
151-
if(mode==encodingMode.dynamic){
154+
if(mode === encodingMode.dynamic){
152155
previousLength += +(encoded[i - 1])[0] || 0;
153156
}
154-
else if(mode==encodingMode.static){
157+
else if(mode === encodingMode.static){
155158
previousLength += +(encoded[i - 1] || [])[0] || 0;
156159
}
157160
result += f.formatInputInt(offset + i * nestedStaticPartLength + previousLength * 32).encode();
158161
}
159162
}
160163

161-
var len=(mode==encodingMode.dynamic?encoded.length-1:encoded.length);
162-
for (var i = 0; i < len; i++) {
164+
var len= (mode === encodingMode.dynamic ? encoded.length-1 : encoded.length);
165+
for (var c = 0; c < len; c++) {
163166
var additionalOffset = result / 2;
164-
if(mode==encodingMode.dynamic){
165-
result += self.encodeWithOffset(nestedName, solidityType, encoded[i + 1], offset + additionalOffset);
167+
if(mode === encodingMode.dynamic){
168+
result += self.encodeWithOffset(nestedName, solidityType, encoded[c + 1], offset + additionalOffset);
166169
}
167-
else if(mode==encodingMode.static){
168-
result += self.encodeWithOffset(nestedName, solidityType, encoded[i], offset + additionalOffset);
170+
else if(mode === encodingMode.static){
171+
result += self.encodeWithOffset(nestedName, solidityType, encoded[c], offset + additionalOffset);
169172
}
170173
}
171174

lib/web3/formatters.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
'use strict'
2-
31
/*
42
This file is part of web3.js.
53
@@ -23,6 +21,9 @@
2321
* @date 2015
2422
*/
2523

24+
'use strict';
25+
26+
2627
var utils = require('../utils/utils');
2728
var config = require('../utils/config');
2829
var Iban = require('./iban');

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"build": "gulp",
4141
"watch": "gulp watch",
4242
"lint": "jshint *.js lib",
43-
"test": "mocha",
43+
"test": "mocha; jshint *.js lib",
4444
"test-coveralls": "istanbul cover _mocha -- -R spec && cat coverage/lcov.info | coveralls --verbose"
4545
},
4646
"repository": {

0 commit comments

Comments
 (0)