This repository was archived by the owner on Dec 20, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 6 files changed +12
-6
lines changed Expand file tree Collapse file tree 6 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,8 @@ var encodings = require('./encodings');
2
2
var walk = require ( './walk' ) ;
3
3
4
4
module . exports = function decodeKey ( key , optionObjects ) {
5
- var encoding = walk ( optionObjects , 'keyEncoding' ) || 'utf8' ;
5
+ var encoding = walk ( optionObjects , 'keyEncoding' ) ;
6
6
if ( typeof encoding == 'string' ) encoding = encodings [ encoding ] ;
7
+ if ( ! encoding ) return key ;
7
8
return encoding . decode ( key ) ;
8
9
} ;
Original file line number Diff line number Diff line change @@ -2,8 +2,9 @@ var encodings = require('./encodings');
2
2
var walk = require ( './walk' ) ;
3
3
4
4
module . exports = function decodeValue ( value , optionObjects ) {
5
- var encoding = walk ( optionObjects , 'valueEncoding' ) || 'utf8' ;
5
+ var encoding = walk ( optionObjects , 'valueEncoding' ) ;
6
6
if ( typeof encoding == 'string' ) encoding = encodings [ encoding ] ;
7
+ if ( ! encoding ) return value ;
7
8
return encoding . decode ( value ) ;
8
9
} ;
9
10
Original file line number Diff line number Diff line change @@ -2,7 +2,8 @@ var encodings = require('./encodings');
2
2
var walk = require ( './walk' ) ;
3
3
4
4
module . exports = function encodeKey ( key , optionObjects ) {
5
- var encoding = walk ( optionObjects , 'keyEncoding' ) || 'utf8' ;
5
+ var encoding = walk ( optionObjects , 'keyEncoding' ) ;
6
6
if ( typeof encoding == 'string' ) encoding = encodings [ encoding ] ;
7
+ if ( ! encoding ) return key ;
7
8
return encoding . encode ( key ) ;
8
9
} ;
Original file line number Diff line number Diff line change @@ -2,8 +2,9 @@ var encodings = require('./encodings');
2
2
var walk = require ( './walk' ) ;
3
3
4
4
module . exports = function encodeValue ( value , optionObjects ) {
5
- var encoding = walk ( optionObjects , 'valueEncoding' ) || 'utf8' ;
5
+ var encoding = walk ( optionObjects , 'valueEncoding' ) ;
6
6
if ( typeof encoding == 'string' ) encoding = encodings [ encoding ] ;
7
+ if ( ! encoding ) return value ;
7
8
return encoding . encode ( value ) ;
8
9
} ;
9
10
Original file line number Diff line number Diff line change @@ -2,7 +2,8 @@ var encodings = require('./encodings');
2
2
var walk = require ( './walk' ) ;
3
3
4
4
module . exports = function keyAsBuffer ( optionObjects ) {
5
- var encoding = walk ( optionObjects , 'keyEncoding' ) || 'utf8' ;
5
+ var encoding = walk ( optionObjects , 'keyEncoding' ) ;
6
6
if ( typeof encoding == 'string' ) encoding = encodings [ encoding ] ;
7
+ if ( ! encoding ) return false ;
7
8
return encoding . buffer ;
8
9
} ;
Original file line number Diff line number Diff line change @@ -2,7 +2,8 @@ var encodings = require('./encodings');
2
2
var walk = require ( './walk' ) ;
3
3
4
4
module . exports = function valueAsBuffer ( optionObjects ) {
5
- var encoding = walk ( optionObjects , 'valueEncoding' ) || 'utf8' ;
5
+ var encoding = walk ( optionObjects , 'valueEncoding' ) ;
6
6
if ( typeof encoding == 'string' ) encoding = encodings [ encoding ] ;
7
+ if ( ! encoding ) return false ;
7
8
return encoding . buffer ;
8
9
} ;
You can’t perform that action at this time.
0 commit comments