Skip to content

Commit

Permalink
Updated lib/decode: Cosmetics
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonas Hermsmeier committed Jul 10, 2013
1 parent 1954733 commit e815e8f
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions lib/decode.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,26 +88,27 @@ decode.list = function() {
decode.integer = function() {

var end = decode.find( 0x65 )
var number = decode.data.toString('ascii', decode.position+1, end )
var number = decode.data.toString( 'ascii', decode.position + 1, end )

decode.position += end + 1 - decode.position

return parseInt( number )
return parseInt( number, 10 )

}

decode.bytes = function() {

var sep = decode.find( 0x3A )
var length = parseInt(decode.data.toString('ascii', decode.position, sep ), 10)
var length = parseInt( decode.data.toString( 'ascii', decode.position, sep ), 10 )
var end = ++sep + length

decode.position += end - decode.position

return decode.encoding
? decode.data.toString(decode.encoding, sep, end )
: decode.data.slice( sep, end )
? decode.data.toString( decode.encoding, sep, end )
: decode.data.slice( sep, end )

}

// Expose
// Exports
module.exports = decode

0 comments on commit e815e8f

Please sign in to comment.