Skip to content

Commit c7ae9c1

Browse files
committed
🎨 Optimize transcode
1 parent aa582a0 commit c7ae9c1

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/spawn.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ if (!transcode) {
3232
* @returns {Buffer}
3333
*/
3434
transcode = function(source, fromEncoding, toEncoding) {
35+
// Same encoding
36+
if (fromEncoding === toEncoding) return source;
37+
38+
// Transcode
3539
return toBuffer(source.toString(fromEncoding), toEncoding);
3640
};
3741
}

0 commit comments

Comments
 (0)