-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
changed encoder to preserve a single buffer, exposed encoder
- Loading branch information
1 parent
788e0a1
commit d4cb247
Showing
6 changed files
with
56 additions
and
49 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
// decode.js | ||
|
||
exports.decode = decode; | ||
|
||
var Decoder = require("./decoder").Decoder; | ||
|
||
exports.Decoder = Decoder; | ||
|
||
function decode(input) { | ||
var output = []; | ||
var decoder = new Decoder(output); | ||
decoder.decode(input); | ||
return output[0]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,11 @@ | ||
// encode.js | ||
|
||
exports.encode = encode; | ||
|
||
var Encoder = require("./encoder").Encoder; | ||
|
||
exports.Encoder = Encoder; | ||
|
||
function encode(input) { | ||
var output = []; | ||
var encoder = new Encoder(output); | ||
encoder.encode(input); | ||
return (output.length === 1) ? output[0] : Buffer.concat(output); | ||
} | ||
var encoder = new Encoder(); | ||
return encoder.encode(input); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters