UNPKG

slonik-trpc

Version:
19 lines (18 loc) 601 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.fromCursor = exports.toCursor = void 0; const toCursor = (ids) => { if (ids && typeof ids === 'object') { return Buffer.from(JSON.stringify(ids)).toString("base64"); } else if (ids && typeof ids === 'string') { // In case json is returned as string return Buffer.from(ids).toString("base64"); } return ''; }; exports.toCursor = toCursor; const fromCursor = (cursor) => { return JSON.parse(Buffer.from(cursor, "base64").toString()); }; exports.fromCursor = fromCursor;