/**
 * Created by anth on 21.05.2017.
 */ import { Buffer } from 'buffer' ; import * as zlib from 'zlib' ; const toExport = { param str returns { Object } decode : { 0 : ( str ) => { let data = null ; try { data = JSON . parse ( zlib . inflateSync ( Buffer . from ( str . slice ( 1 ) , 'base64' ) ) . toString ( 'utf8' ) ) ; } catch ( e ) { throw e ; } return data ; } , latest : ( str ) => ( { } as any ) , } , param obj returns { string } encode : { 0 : ( obj ) => { return '0' + zlib . deflateSync ( JSON . stringify ( obj ) ) . toString ( 'base64' ) ; } , latest : ( obj ) => '' , } , } ; toExport . decode . latest = toExport . decode [ 0 ] ; toExport . encode . latest = toExport . encode [ 0 ] ; export default toExport ;