Skip to content

Commit

Permalink
Merge pull request #21 from debris/master
Browse files Browse the repository at this point in the history
fixed gulp build
  • Loading branch information
debris committed Jan 7, 2015
2 parents 1954b87 + b6232cf commit 6c160ad
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 26 deletions.
6 changes: 3 additions & 3 deletions dist/ethereum.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/ethereum.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/ethereum.min.js

Large diffs are not rendered by default.

File renamed without changes.
2 changes: 1 addition & 1 deletion lib/abi.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ var findMethodIndex = function (json, methodName) {
};

var padLeft = function (string, chars) {
return Array(chars - string.length + 1).join("0") + string;
return new Array(chars - string.length + 1).join("0") + string;
};

var setupInputTypes = function () {
Expand Down
7 changes: 3 additions & 4 deletions lib/autoprovider.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,11 @@
* if it fails, it uses HttpRpcProvider
*/

// TODO: work out which of the following two lines it is supposed to be...
//if (process.env.NODE_ENV !== 'build') {
if ("build" !== 'build') {/*
// TODO: is these line is supposed to be here?
if (process.env.NODE_ENV !== 'build') {
var WebSocket = require('ws'); // jshint ignore:line
var web3 = require('./main.js'); // jshint ignore:line
*/}
}

var AutoProvider = function (userOptions) {
if (web3.haveProvider()) {
Expand Down
8 changes: 4 additions & 4 deletions lib/contract.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
* @date 2014
*/

// TODO: work out which of the following two lines it is supposed to be...
//if (process.env.NODE_ENV !== 'build') {
if ("build" !== 'build') {/*
// TODO: is these line is supposed to be here?
if (process.env.NODE_ENV !== 'build') {
var web3 = require('./web3'); // jshint ignore:line
*/}
}

var abi = require('./abi');

var contract = function (address, desc) {
Expand Down
7 changes: 3 additions & 4 deletions lib/httprpc.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,10 @@
* @date 2014
*/

// TODO: work out which of the following two lines it is supposed to be...
//if (process.env.NODE_ENV !== 'build') {
if ("build" !== "build") {/*
// TODO: is these line is supposed to be here?
if (process.env.NODE_ENV !== 'build') {
var XMLHttpRequest = require('xmlhttprequest').XMLHttpRequest; // jshint ignore:line
*/}
}

var HttpRpcProvider = function (host) {
this.handlers = [];
Expand Down
10 changes: 7 additions & 3 deletions lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ var web3 = {
},

toEth: function(str) {
var val = typeof str === "string" ? str.indexOf('0x') == 0 ? parseInt(str.substr(2), 16) : parseInt(str) : str;
var val = typeof str === "string" ? str.indexOf('0x') === 0 ? parseInt(str.substr(2), 16) : parseInt(str) : str;
var unit = 0;
var units = [ 'wei', 'Kwei', 'Mwei', 'Gwei', 'szabo', 'finney', 'ether', 'grand', 'Mether', 'Gether', 'Tether', 'Pether', 'Eether', 'Zether', 'Yether', 'Nether', 'Dether', 'Vether', 'Uether' ];
while (val > 3000 && unit < units.length - 1)
Expand All @@ -281,10 +281,14 @@ var web3 = {
unit++;
}
var s = val.toString().length < val.toFixed(2).length ? val.toString() : val.toFixed(2);
var replaceFunction = function($0, $1, $2) {
return $1 + ',' + $2;
};

while (true) {
var o = s;
s = s.replace(/(\d)(\d\d\d[\.\,])/, function($0, $1, $2) { return $1 + ',' + $2; });
if (o == s)
s = s.replace(/(\d)(\d\d\d[\.\,])/, replaceFunction);
if (o === s)
break;
}
return s + ' ' + units[unit];
Expand Down
7 changes: 3 additions & 4 deletions lib/websocket.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,10 @@
* @date 2014
*/

// TODO: work out which of the following two lines it is supposed to be...
//if (process.env.NODE_ENV !== 'build') {
if ("build" !== "build") {/*
// TODO: is these line is supposed to be here?
if (process.env.NODE_ENV !== 'build') {
var WebSocket = require('ws'); // jshint ignore:line
*/}
}

var WebSocketProvider = function(host) {
// onmessage handlers
Expand Down

0 comments on commit 6c160ad

Please sign in to comment.