File tree Expand file tree Collapse file tree 1 file changed +3
-12
lines changed
Expand file tree Collapse file tree 1 file changed +3
-12
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ const fs = require('fs');
88 */
99
1010module . exports . isSet = function ( value ) {
11- return typeof value !== "undefined" && value !== null && value . length !== 0 ;
11+ return isSet ( value ) ;
1212} ;
1313
1414isSet = function ( value ) {
@@ -23,16 +23,7 @@ isSet = function (value) {
2323 * @returns {string } encoded string
2424 */
2525module . exports . bytesToString = function ( bytes , dataEncoding ) {
26- if ( typeof bytes === "undefined" || bytes === null ) {
27- throw new Error ( "Input not valid" ) ;
28- }
29- switch ( dataEncoding . toLowerCase ( ) ) {
30- case 'hex' :
31- return forge . util . bytesToHex ( bytes ) ;
32- case 'base64' :
33- default :
34- return forge . util . encode64 ( bytes ) ;
35- }
26+ return bytesToString ( bytes , dataEncoding ) ;
3627} ;
3728
3829function bytesToString ( bytes , dataEncoding ) {
@@ -46,7 +37,7 @@ function bytesToString(bytes, dataEncoding) {
4637 default :
4738 return forge . util . encode64 ( bytes ) ;
4839 }
49- } ;
40+ }
5041
5142/**
5243 * Converts a (hex or base64) string into a 'binary' encoded string of bytes.
You can’t perform that action at this time.
0 commit comments