@@ -479,9 +479,9 @@ var buildRedisStoreWithConfig = function buildRedisStoreWithConfig(redisCache, c
479479 _context . next = 7 ;
480480 break ;
481481 }
482- return _context . abrupt ( "return" , redisCache . setEx ( key , ttl , getValue ( value ) ) ) ;
482+ return _context . abrupt ( "return" , redisCache . setEx ( key , ttl , encodeValue ( value ) ) ) ;
483483 case 7 :
484- return _context . abrupt ( "return" , redisCache . set ( key , getValue ( value ) ) ) ;
484+ return _context . abrupt ( "return" , redisCache . set ( key , encodeValue ( value ) ) ) ;
485485 case 8 :
486486 case "end" :
487487 return _context . stop ( ) ;
@@ -510,7 +510,7 @@ var buildRedisStoreWithConfig = function buildRedisStoreWithConfig(redisCache, c
510510 }
511511 return _context2 . abrupt ( "return" , null ) ;
512512 case 5 :
513- return _context2 . abrupt ( "return" , options . parse !== false ? JSON . parse ( val ) : val ) ;
513+ return _context2 . abrupt ( "return" , options . parse !== false ? decodeValue ( val ) : val ) ;
514514 case 6 :
515515 case "end" :
516516 return _context2 . stop ( ) ;
@@ -561,7 +561,7 @@ var buildRedisStoreWithConfig = function buildRedisStoreWithConfig(redisCache, c
561561 if ( ! isCacheableValue ( value ) ) {
562562 throw new Error ( "\"" . concat ( value , "\" is not a cacheable value" ) ) ;
563563 }
564- return [ key , getValue ( value ) ] ;
564+ return [ key , encodeValue ( value ) ] ;
565565 } ) . filter ( function ( key ) {
566566 return key !== null ;
567567 } ) ;
@@ -619,7 +619,7 @@ var buildRedisStoreWithConfig = function buildRedisStoreWithConfig(redisCache, c
619619 if ( val === null ) {
620620 return null ;
621621 }
622- return options . parse !== false ? JSON . parse ( val ) : val ;
622+ return options . parse !== false ? decodeValue ( val ) : val ;
623623 } ) ;
624624 } ) ) ;
625625 case 4 :
@@ -825,9 +825,12 @@ var buildRedisStoreWithConfig = function buildRedisStoreWithConfig(redisCache, c
825825 }
826826 } ;
827827} ;
828- function getValue ( value ) {
828+ function encodeValue ( value ) {
829829 return JSON . stringify ( value ) || '"undefined"' ;
830830}
831+ function decodeValue ( val ) {
832+ return JSON . parse ( val ) ;
833+ }
831834function isObject ( object ) {
832835 return _typeof ( object ) === 'object' && ! Array . isArray ( object ) && object !== null ;
833836}
0 commit comments