3 lines
360 B
TypeScript
3 lines
360 B
TypeScript
// Bound each SQL value to at most 512 KiB of UTF-8; preserve all resident history.
|
|
export function splitState(state:unknown){const text=JSON.stringify(state),chunks:string[]=[];for(let i=0;i<text.length;){let end=Math.min(i+120000,text.length);const c=text.charCodeAt(end-1);if(c>=0xd800&&c<=0xdbff)end--;chunks.push(text.slice(i,end));i=end;}return chunks;}
|