@@ -745,7 +745,7 @@ const numDecode = (text, key) => {
745745 return num ;
746746}
747747
748- export const encode = ( text , key , compress ) => {
748+ function encode5 ( text , key , compress ) {
749749 if ( text === undefined || text === null ) throw new Error ( errors [ 3 ] ( 'encoded' , 'Text' ) ) ;
750750 if ( typeof text !== 'string' ) throw new Error ( errors [ 2 ] ( 'encoded' , 'Text' , 'string' ) ) ;
751751 if ( key !== undefined && key !== null && typeof key !== 'string' ) throw new Error ( errors [ 2 ] ( 'encoded' , 'Key' , 'string' ) ) ;
@@ -759,12 +759,12 @@ export const encode = (text, key, compress) => {
759759 if ( doubleEncoded . length < encoded_ . length ) {
760760 output_ = `J${ doubleEncoded } ` ;
761761 }
762- if ( / ^ [ 0 - 9 ] + $ / . test ( text ) && ( key === undefined || key === null || key === '' ) && decode ( numEncoded , key ) === text ) output_ = numEncoded ;
762+ if ( / ^ [ 0 - 9 ] + $ / . test ( text ) && ( key === undefined || key === null || key === '' ) && decode5 ( numEncoded , key ) === text ) output_ = numEncoded ;
763763 }
764764 if ( even_or_odd ( output_ . length ) ) output_ = output_ . split ( '' ) . reverse ( ) . join ( '' ) ;
765765 return output_ ;
766- } ;
767- export const decode = ( text , key ) => {
766+ }
767+ function decode5 ( text , key ) {
768768 let input_ = text ;
769769 if ( even_or_odd ( input_ . length ) ) input_ = input_ . split ( '' ) . reverse ( ) . join ( '' ) ;
770770 if ( input_ === undefined || input_ === null ) throw new Error ( errors [ 3 ] ( 'decoded' , 'Text' ) ) ;
@@ -782,5 +782,12 @@ export const decode = (text, key) => {
782782 output_ = decode4 ( input_ , key ) ;
783783 }
784784 return output_ ;
785+ }
786+
787+ export const encode = ( text , key , compress ) => {
788+ return encode5 ( text , key , compress ) ;
789+ } ;
790+ export const decode = ( text , key ) => {
791+ return decode5 ( text , key ) ;
785792} ;
786793
0 commit comments