Skip to content

Commit

Permalink
🎨 Optimize transcode
Browse files Browse the repository at this point in the history
  • Loading branch information
nuintun committed Apr 28, 2018
1 parent aa582a0 commit c7ae9c1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/spawn.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ if (!transcode) {
* @returns {Buffer}
*/
transcode = function(source, fromEncoding, toEncoding) {
// Same encoding
if (fromEncoding === toEncoding) return source;

// Transcode
return toBuffer(source.toString(fromEncoding), toEncoding);
};
}
Expand Down

0 comments on commit c7ae9c1

Please sign in to comment.