mirror of https://github.com/nodejs/node.git
string_decoder: don't cache Buffer.isEncoding
Some modules are monkey-patching Buffer.isEncoding, so without this they cannot do that. Fixes: https://github.com/iojs/io.js/issues/1547 PR-URL: https://github.com/iojs/io.js/pull/1548 Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>pull/1548/merge
parent
e55fdc47a7
commit
0fa6c4a6fc
|
@ -1,9 +1,9 @@
|
|||
'use strict';
|
||||
|
||||
const isEncoding = Buffer.isEncoding;
|
||||
|
||||
function assertEncoding(encoding) {
|
||||
if (encoding && !isEncoding(encoding)) {
|
||||
// Do not cache `Buffer.isEncoding`, some modules monkey-patch it to support
|
||||
// additional encodings
|
||||
if (encoding && !Buffer.isEncoding(encoding)) {
|
||||
throw new Error('Unknown encoding: ' + encoding);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue