fixed gulp errors

This commit is contained in:
Marek Kotewicz 2015-03-11 10:24:03 +01:00
parent 9926e27a84
commit d2dbc2d5d6
7 changed files with 66 additions and 54 deletions

54
dist/ethereum.js vendored
View File

@ -817,9 +817,7 @@ var fromDecimal = function (value) {
var number = toBigNumber(value); var number = toBigNumber(value);
var result = number.toString(16); var result = number.toString(16);
return (number.lessThan(0)) return number.lessThan(0) ? '-0x' + result.substr(1) : '0x' + result;
? '-0x' + result.substr(1)
: '0x' + result;
}; };
/** /**
@ -832,6 +830,7 @@ var fromDecimal = function (value) {
* @return {String} * @return {String}
*/ */
var toHex = function (val) { var toHex = function (val) {
/*jshint maxcomplexity:7 */
if(isBoolean(val)) if(isBoolean(val))
return val; return val;
@ -893,8 +892,7 @@ var getValueOfUnit = function (unit) {
var fromWei = function(number, unit) { var fromWei = function(number, unit) {
var returnValue = toBigNumber(number).dividedBy(getValueOfUnit(unit)); var returnValue = toBigNumber(number).dividedBy(getValueOfUnit(unit));
return (isBigNumber(number)) return isBigNumber(number) ? returnValue : returnValue.toString(10);
? returnValue : returnValue.toString(10);
}; };
/** /**
@ -920,8 +918,7 @@ var fromWei = function(number, unit) {
var toWei = function(number, unit) { var toWei = function(number, unit) {
var returnValue = toBigNumber(number).times(getValueOfUnit(unit)); var returnValue = toBigNumber(number).times(getValueOfUnit(unit));
return (isBigNumber(number)) return isBigNumber(number) ? returnValue : returnValue.toString(10);
? returnValue : returnValue.toString(10);
}; };
/** /**
@ -932,13 +929,16 @@ var toWei = function(number, unit) {
* @return {BigNumber} BigNumber * @return {BigNumber} BigNumber
*/ */
var toBigNumber = function(number) { var toBigNumber = function(number) {
/*jshint maxcomplexity:5 */
number = number || 0; number = number || 0;
if (isBigNumber(number)) if (isBigNumber(number))
return number; return number;
return (isString(number) && (number.indexOf('0x') === 0 || number.indexOf('-0x') === 0)) if (isString(number) && (number.indexOf('0x') === 0 || number.indexOf('-0x') === 0)) {
? new BigNumber(number.replace('0x',''), 16) return new BigNumber(number.replace('0x',''), 16);
: new BigNumber(number.toString(10), 10); }
return new BigNumber(number.toString(10), 10);
}; };
/** /**
@ -1029,6 +1029,17 @@ var isBoolean = function (object) {
return typeof object === 'boolean'; return typeof object === 'boolean';
}; };
/**
* Returns true if object is array, otherwise false
*
* @method isArray
* @param {Object}
* @return {Boolean}
*/
var isArray = function (object) {
return object instanceof Array;
};
module.exports = { module.exports = {
findIndex: findIndex, findIndex: findIndex,
toHex: toHex, toHex: toHex,
@ -1049,7 +1060,8 @@ module.exports = {
isFunction: isFunction, isFunction: isFunction,
isString: isString, isString: isString,
isObject: isObject, isObject: isObject,
isBoolean: isBoolean isBoolean: isBoolean,
isArray: isArray
}; };
@ -1950,7 +1962,7 @@ var implementationIsValid = function (i) {
/// @param should be string or object /// @param should be string or object
/// @returns options string or object /// @returns options string or object
var getOptions = function (options) { var getOptions = function (options) {
/*jshint maxcomplexity:5 */ /*jshint maxcomplexity:9 */
if (typeof options === 'string') { if (typeof options === 'string') {
return options; return options;
@ -2043,11 +2055,9 @@ var filter = function(options, implementation, formatter) {
var get = function () { var get = function () {
var results = implementation.getLogs(filterId); var results = implementation.getLogs(filterId);
return (results instanceof Array) return utils.isArray(results) ? results.map(function(message){
? results.map(function(message){
return formatter ? formatter(message) : message; return formatter ? formatter(message) : message;
}) }) : results;
: results;
}; };
return { return {
@ -2335,7 +2345,7 @@ HttpProvider.prototype.send = function (payload, callback) {
if(request.readyState === 4) { if(request.readyState === 4) {
var result = ''; var result = '';
try { try {
result = JSON.parse(request.responseText) result = JSON.parse(request.responseText);
} catch(error) { } catch(error) {
result = error; result = error;
} }
@ -2547,24 +2557,20 @@ var requestManager = function() {
var provider; var provider;
var send = function (data, callback) { var send = function (data, callback) {
/*jshint maxcomplexity: 7 */ /*jshint maxcomplexity: 8 */
// FORMAT BASED ON ONE FORMATTER function // FORMAT BASED ON ONE FORMATTER function
if(typeof data.inputFormatter === 'function') { if(typeof data.inputFormatter === 'function') {
data.params = Array.prototype.map.call(data.params, function(item, index){ data.params = Array.prototype.map.call(data.params, function(item, index){
// format everything besides the defaultblock, which is already formated // format everything besides the defaultblock, which is already formated
return (!data.addDefaultblock || index+1 < data.addDefaultblock) return (!data.addDefaultblock || index+1 < data.addDefaultblock) ? data.inputFormatter(item) : item;
? data.inputFormatter(item)
: item;
}); });
// FORMAT BASED ON the input FORMATTER ARRAY // FORMAT BASED ON the input FORMATTER ARRAY
} else if(data.inputFormatter instanceof Array) { } else if(data.inputFormatter instanceof Array) {
data.params = Array.prototype.map.call(data.inputFormatter, function(formatter, index){ data.params = Array.prototype.map.call(data.inputFormatter, function(formatter, index){
// format everything besides the defaultblock, which is already formated // format everything besides the defaultblock, which is already formated
return (!data.addDefaultblock || index+1 < data.addDefaultblock) return (!data.addDefaultblock || index+1 < data.addDefaultblock) ? formatter(data.params[index]) : data.params[index];
? formatter(data.params[index])
: data.params[index];
}); });
} }

10
dist/ethereum.js.map vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -199,9 +199,7 @@ var fromDecimal = function (value) {
var number = toBigNumber(value); var number = toBigNumber(value);
var result = number.toString(16); var result = number.toString(16);
return (number.lessThan(0)) return number.lessThan(0) ? '-0x' + result.substr(1) : '0x' + result;
? '-0x' + result.substr(1)
: '0x' + result;
}; };
/** /**
@ -214,6 +212,7 @@ var fromDecimal = function (value) {
* @return {String} * @return {String}
*/ */
var toHex = function (val) { var toHex = function (val) {
/*jshint maxcomplexity:7 */
if(isBoolean(val)) if(isBoolean(val))
return val; return val;
@ -275,8 +274,7 @@ var getValueOfUnit = function (unit) {
var fromWei = function(number, unit) { var fromWei = function(number, unit) {
var returnValue = toBigNumber(number).dividedBy(getValueOfUnit(unit)); var returnValue = toBigNumber(number).dividedBy(getValueOfUnit(unit));
return (isBigNumber(number)) return isBigNumber(number) ? returnValue : returnValue.toString(10);
? returnValue : returnValue.toString(10);
}; };
/** /**
@ -302,8 +300,7 @@ var fromWei = function(number, unit) {
var toWei = function(number, unit) { var toWei = function(number, unit) {
var returnValue = toBigNumber(number).times(getValueOfUnit(unit)); var returnValue = toBigNumber(number).times(getValueOfUnit(unit));
return (isBigNumber(number)) return isBigNumber(number) ? returnValue : returnValue.toString(10);
? returnValue : returnValue.toString(10);
}; };
/** /**
@ -314,13 +311,16 @@ var toWei = function(number, unit) {
* @return {BigNumber} BigNumber * @return {BigNumber} BigNumber
*/ */
var toBigNumber = function(number) { var toBigNumber = function(number) {
/*jshint maxcomplexity:5 */
number = number || 0; number = number || 0;
if (isBigNumber(number)) if (isBigNumber(number))
return number; return number;
return (isString(number) && (number.indexOf('0x') === 0 || number.indexOf('-0x') === 0)) if (isString(number) && (number.indexOf('0x') === 0 || number.indexOf('-0x') === 0)) {
? new BigNumber(number.replace('0x',''), 16) return new BigNumber(number.replace('0x',''), 16);
: new BigNumber(number.toString(10), 10); }
return new BigNumber(number.toString(10), 10);
}; };
/** /**
@ -411,6 +411,17 @@ var isBoolean = function (object) {
return typeof object === 'boolean'; return typeof object === 'boolean';
}; };
/**
* Returns true if object is array, otherwise false
*
* @method isArray
* @param {Object}
* @return {Boolean}
*/
var isArray = function (object) {
return object instanceof Array;
};
module.exports = { module.exports = {
findIndex: findIndex, findIndex: findIndex,
toHex: toHex, toHex: toHex,
@ -431,6 +442,7 @@ module.exports = {
isFunction: isFunction, isFunction: isFunction,
isString: isString, isString: isString,
isObject: isObject, isObject: isObject,
isBoolean: isBoolean isBoolean: isBoolean,
isArray: isArray
}; };

View File

@ -40,7 +40,7 @@ var implementationIsValid = function (i) {
/// @param should be string or object /// @param should be string or object
/// @returns options string or object /// @returns options string or object
var getOptions = function (options) { var getOptions = function (options) {
/*jshint maxcomplexity:5 */ /*jshint maxcomplexity:9 */
if (typeof options === 'string') { if (typeof options === 'string') {
return options; return options;
@ -133,11 +133,9 @@ var filter = function(options, implementation, formatter) {
var get = function () { var get = function () {
var results = implementation.getLogs(filterId); var results = implementation.getLogs(filterId);
return (results instanceof Array) return utils.isArray(results) ? results.map(function(message){
? results.map(function(message){
return formatter ? formatter(message) : message; return formatter ? formatter(message) : message;
}) }) : results;
: results;
}; };
return { return {

View File

@ -41,7 +41,7 @@ HttpProvider.prototype.send = function (payload, callback) {
if(request.readyState === 4) { if(request.readyState === 4) {
var result = ''; var result = '';
try { try {
result = JSON.parse(request.responseText) result = JSON.parse(request.responseText);
} catch(error) { } catch(error) {
result = error; result = error;
} }

View File

@ -37,24 +37,20 @@ var requestManager = function() {
var provider; var provider;
var send = function (data, callback) { var send = function (data, callback) {
/*jshint maxcomplexity: 7 */ /*jshint maxcomplexity: 8 */
// FORMAT BASED ON ONE FORMATTER function // FORMAT BASED ON ONE FORMATTER function
if(typeof data.inputFormatter === 'function') { if(typeof data.inputFormatter === 'function') {
data.params = Array.prototype.map.call(data.params, function(item, index){ data.params = Array.prototype.map.call(data.params, function(item, index){
// format everything besides the defaultblock, which is already formated // format everything besides the defaultblock, which is already formated
return (!data.addDefaultblock || index+1 < data.addDefaultblock) return (!data.addDefaultblock || index+1 < data.addDefaultblock) ? data.inputFormatter(item) : item;
? data.inputFormatter(item)
: item;
}); });
// FORMAT BASED ON the input FORMATTER ARRAY // FORMAT BASED ON the input FORMATTER ARRAY
} else if(data.inputFormatter instanceof Array) { } else if(data.inputFormatter instanceof Array) {
data.params = Array.prototype.map.call(data.inputFormatter, function(formatter, index){ data.params = Array.prototype.map.call(data.inputFormatter, function(formatter, index){
// format everything besides the defaultblock, which is already formated // format everything besides the defaultblock, which is already formated
return (!data.addDefaultblock || index+1 < data.addDefaultblock) return (!data.addDefaultblock || index+1 < data.addDefaultblock) ? formatter(data.params[index]) : data.params[index];
? formatter(data.params[index])
: data.params[index];
}); });
} }