export type CursorDataType = { [ fieldName ] : any ; } | any ; export function base64 ( i ) { return Buffer . from ( i , 'ascii' ) . toString ( 'base64' ) ; } export function unbase64 ( i ) { return Buffer . from ( i , 'base64' ) . toString ( 'ascii' ) ; } export function cursorToData ( cursor ? ) { if ( typeof cursor === 'string' ) { try { return JSON . parse ( unbase64 ( cursor ) ) || null ; } catch ( err ) { return null ; } } return null ; } export function dataToCursor ( data ) { return base64 ( JSON . stringify ( data ) ) ; }