Skip to content

Commit 1b23685

Browse files
authored
Merge pull request #583 from dolphin278/patch-1
Fix node encodings lookup in string parser
2 parents e4e74b8 + 332cdf1 commit 1b23685

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/parsers/string.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ var NODE_ENCODING = [
99
'latin1',
1010
'binary',
1111
'hex'
12-
];
12+
].reduce(function (map, item) {
13+
map[item] = Buffer.isEncoding(item);
14+
return map;
15+
}, {});
1316

1417
exports.decode = function(buffer, encoding, options) {
1518
if (NODE_ENCODING[encoding]) {

0 commit comments

Comments
 (0)