Skip to content

Commit 1954b87

Browse files
committed
bring back toHex
1 parent 123098c commit 1954b87

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

lib/main.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,16 @@ var web3 = {
227227
_events: {},
228228
providers: {},
229229

230+
toHex: function(str) {
231+
var hex = "";
232+
for(var i = 0; i < str.length; i++) {
233+
var n = str.charCodeAt(i).toString(16);
234+
hex += n.length < 2 ? '0' + n : n;
235+
}
236+
237+
return hex;
238+
},
239+
230240
toAscii: function(hex) {
231241
// Find termination
232242
var str = "";

0 commit comments

Comments
 (0)